*MAFIA* Forums

*MAFIA* Forums

  • April 25, 2024, 01:06:45 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome back the Arcade! Play over 100+ games to get the high score and compete against other forum members.

http://www.mafiaowns.com/index.php?action=arcade;sa=list;sortby=a2z;

Author Topic: C++ Help  (Read 2926 times)

Partyboy

  • Forum Member
  • Reputation: 681
  • Offline Offline
  • Posts: 1,065
    • View Profile
C++ Help
« on: November 21, 2006, 07:32:26 PM »

Okay im trying to follow this tut for the 2nd time. the first time i kept getting this error but today i tried again and got the same error. Whats wrong with it?

Code: [Select]
#include

using namespace std;

void main (void)
{
int UserAge = 0;
char Person = 'b';


cout << "What is your age?: ";
cin >> UsersAge:

if ((UsersAge >= 0) && (UsersAge <=4))

{
Person 'b';
}
else
{
if ((UsersAge >= 5) && (UsersAge <=20))
Person = 'y';
else
{
if ((UsersAge >= 21) && (UsersAge <=65))
Person = 'a';
else
{
if ((UsersAge >= 66) && (UsersAge <=135))
Person = 'o';
else
Person 'x';
}
}
}


if (Person == 'b')
{
cout << "Hi there, you are a baby- Becuase you are " << UsersAge << " years old" ;
}
else
{
if (Person == 'y')
cout << "Hi there, you are a teenager- Becuase you are " << UsersAge << " years old" ;
else
{
if (Person == 'a')
cout << "Hi there, you are a adult- Becuase you are " << UsersAge << " years old" ;
else
{
if (Person == 'o')
cout << "Hi there, you are an old person- Becuase you are " << UsersAge << " years old" ;
else
{
if (Person == 'x')
cout << "I think you are lying becuse you are not " << UsersAge << " years old" ;
}
}
}
}

}
Logged

*MAFIA* Bonehead

  • *MAFIA* Founder
  • Forum Member
  • Reputation: 2584
  • Offline Offline
  • Posts: 8,007
    • View Profile
    • *MAFIA*
C++ Help
« Reply #1 on: November 21, 2006, 10:26:02 PM »

Hmm lets see ah yes...



#include <iostream>

using namespace std;

void main (void)
{
	
int UserAge 0;
	
char Person 'b';


	
cout << "What is your age?: ";
	
cin >> UsersAge:

	
if ((
UsersAge >= 0) && (UsersAge <=4))
	

	
{
	
	
	
Person 'b';
	
}
	
else
	
{
	
	
if ((
UsersAge >= 5) && (UsersAge <=20))
	
	
	
	
Person 'y';
	
	
else
	
	
{
	
	
	
if ((
UsersAge >= 21) && (UsersAge <=65))
	
	
	
	
	
Person 'a';
	
	
	
else
	
	
	
{
	
	
	
	
if ((
UsersAge >= 66) && (UsersAge <=135))
	
	
	
	
	
	
	
Person 'o';
	
	
	
	
else 
	
	
	
	
	
	
	
Person 'x';
	
	
	
}
	
	
	

	
	
}
	
}
	


	
if (
Person == 'b')
	
{
	
	
cout << "Hi there, you are a baby- Becuase you are " << UsersAge << " years old" ;
	
}
	
	
else
	
	
{
	
	
	
if (
Person == 'y')
	
	
	
	
cout << "Hi there, you are a teenager- Becuase you are " << UsersAge << " years old" ;
	
	
	
else
	
	
	
{
	
	
	
	
if (
Person == 'a')
	
	
	
	
	
	
	
cout << "Hi there, you are a adult- Becuase you are " << UsersAge << " years old" ;
	
	
	
	
else
	
	
	
	
{
	
	
	
	
	
if (
Person == 'o')
	
	
	
	
	
	
	
	
cout << "Hi there, you are an old person- Becuase you are " << UsersAge << " years old" ;
	
	
	
	
	
else
	
	
	
	
	
{
	
	
	
	
	
	
if (
Person == 'x')
	
	
	
	
	
	
	
	
cout << "I think you are lying becuse you are not " << UsersAge << " years old" ;
	
	
	
	
	
}
	
	
	
	
}
	
	
	
}
	
	
}
	

}




Well you can always null instead of void, also you did not in-case the = value for each rule set

{
person blah
}


not to mention you are == on all the reference calls what are you double valuing?  if (blah == 'a','b'); else {null}

I didnt carry the close because I wanted you to see a double value line.

Best of luck
Logged

Boemann (nl)

  • Forum Member
  • Reputation: 1155
  • Offline Offline
  • Posts: 1,985
    • View Profile
C++ Help
« Reply #2 on: November 22, 2006, 01:44:15 AM »

Yay, finally something I understand lol. I used to get parse errors (kinda annoying if you have to fix them every time), they just make me freak out lol, so then I stopped doing C++.

Lol anyways, hmm goodluck with C++ party
Logged

*MAFIA* Bonehead

  • *MAFIA* Founder
  • Forum Member
  • Reputation: 2584
  • Offline Offline
  • Posts: 8,007
    • View Profile
    • *MAFIA*
C++ Help
« Reply #3 on: November 22, 2006, 08:29:13 AM »

c++ is almost like php. But you dont have to define every value and where it is like in php.
Logged

Partyboy

  • Forum Member
  • Reputation: 681
  • Offline Offline
  • Posts: 1,065
    • View Profile
C++ Help
« Reply #4 on: November 22, 2006, 01:34:10 PM »

1 Error
Code: [Select]
c:\program files\microsoft visual studio\myprojects\project3\project3.cpp(64) : fatal error C1010: unexpected end of file while looking for precompiled header directive

Pointing to the last closed curly bracket.
Logged

*MAFIA* Bonehead

  • *MAFIA* Founder
  • Forum Member
  • Reputation: 2584
  • Offline Offline
  • Posts: 8,007
    • View Profile
    • *MAFIA*
C++ Help
« Reply #5 on: November 22, 2006, 03:26:00 PM »

Did you make sure, you have the functions set, and the calls to those functions must be closed.

If you have a space after the close it will cause a loop, and a loop will bypass the directives or the functions.

Also you can tell the program to die after execution.

                    {
                   {
                  {
                 {
}
else ('die') add a ; at the end if you wish to make the halt permanent
 {
{

That will prevent a loop.
Logged

Partyboy

  • Forum Member
  • Reputation: 681
  • Offline Offline
  • Posts: 1,065
    • View Profile
C++ Help
« Reply #6 on: November 22, 2006, 04:04:03 PM »

I just put it what you posted up there and i just kept getting that error.
Logged

*MAFIA* Bonehead

  • *MAFIA* Founder
  • Forum Member
  • Reputation: 2584
  • Offline Offline
  • Posts: 8,007
    • View Profile
    • *MAFIA*
C++ Help
« Reply #7 on: November 22, 2006, 04:25:03 PM »

Well I am not going to fix the code for you, remember when you wanted to make hacks? and I helped you but not handed it to you. If you work for it, then you will have a much better feeling knowing you did it and not had others do it for you.

You have a few malformed "Statements" then it will work. You are like 98% there.
Logged

Partyboy

  • Forum Member
  • Reputation: 681
  • Offline Offline
  • Posts: 1,065
    • View Profile
C++ Help
« Reply #8 on: November 22, 2006, 08:02:25 PM »

What about this?
It didnt work but is it going in a better direction?
Hot or Cold?
Code: [Select]
#include

using namespace std;

void main (void)
{
    int UsersAge = 0;
    char Person = 'b';

{
    cout << "What is your age?: ";
    cin >> UsersAge:
}
{
    if ((UsersAge >= 0) && (UsersAge <=4))
   
   
            Person = 'b';
    }
    else
{
        if ((UsersAge >= 5) && (UsersAge <=20))
                Person = 'y';
}
        else
{  
            if ((UsersAge >= 21) && (UsersAge <=65))
                    Person = 'a';
}
            else
{  
                if ((UsersAge >= 66) && (UsersAge <=135))
                            Person = 'o';
}
                else
               
Person = 'x';
{
    if (Person == 'b')

        cout << "Hi there, you are a baby- Becuase you are " << UsersAge << " years old" ;
}
        else
        {
            if (Person == 'y')
                cout << "Hi there, you are a teenager- Becuase you are " << UsersAge << " years old" ;
}
            else
{  
                if (Person == 'a')
                            cout << "Hi there, you are a adult- Becuase you are " << UsersAge << " years old" ;
}
                else
{  
                    if (Person == 'o')
                                cout << "Hi there, you are an old person- Becuase you are " << UsersAge << " years old" ;
}
                    else
{  
                        if (Person == 'x')
                                cout << "I think you are lying becuse you are not " << UsersAge << " years old" ;
}

}
Logged

Boemann (nl)

  • Forum Member
  • Reputation: 1155
  • Offline Offline
  • Posts: 1,985
    • View Profile
C++ Help
« Reply #9 on: November 23, 2006, 12:13:26 AM »

I thought it had to be like this:

if(blah blah)
{



}

But all my C++ is on my laptop, so I can't be sure right now.


Btw how hard is it to make hack with C++? Cause you will have to learn alot, don't you, before you can make hacks?
Logged

-<M>-Ricardo

  • Forum Member
  • Reputation: 0
  • Offline Offline
  • Posts: 70
    • View Profile
C++ Help
« Reply #10 on: November 23, 2006, 04:50:05 AM »

bonehead can you change my  name please?
i want just Ricardo
thx
Logged
RICARDO IS THE FUTURE, #1 AND BEST MAFIAN EVER!
we must realize this or there is no hope...

Boemann (nl)

  • Forum Member
  • Reputation: 1155
  • Offline Offline
  • Posts: 1,985
    • View Profile
C++ Help
« Reply #11 on: November 23, 2006, 05:07:48 AM »

Quote from: *MOFIA*Ricardo
bonehead can you change my  name please?
i want just Ricardo
thx

Can we fucking ban this idiot yet!?!?!! Warning at 100, still no ban
Logged

-<M>-Ricardo

  • Forum Member
  • Reputation: 0
  • Offline Offline
  • Posts: 70
    • View Profile
C++ Help
« Reply #12 on: November 23, 2006, 05:12:27 AM »

n o boeman please no ban !!!
Logged

*MAFIA* Bonehead

  • *MAFIA* Founder
  • Forum Member
  • Reputation: 2584
  • Offline Offline
  • Posts: 8,007
    • View Profile
    • *MAFIA*
C++ Help
« Reply #13 on: November 23, 2006, 08:21:56 AM »

You are damn close you just have an open and close in the wrong place ;)
Logged

*MAFIA* PROHELIM@NKIE

  • *MAFIA* Admin
  • Forum Member
  • Reputation: 142
  • Offline Offline
  • Posts: 256
    • View Profile
Idiot !!!
« Reply #14 on: November 23, 2006, 08:54:22 AM »

Quote from: Ricardo
bonehead can you change my  name please?
i want just Ricardo
thx
Ya Bone he wants his name changed, so change it too " Retardo " for posting in the wrong thread!!!!!!!
Logged
 

Page created in 0.039 seconds with 30 queries.