*MAFIA* Forums

*MAFIA* => Help => Topic started by: Partyboy on November 21, 2006, 07:32:26 PM

Title: C++ Help
Post by: Partyboy 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" ;
}
}
}
}

}
Title: C++ Help
Post by: *MAFIA* Bonehead on November 21, 2006, 10:26:02 PM
Hmm lets see ah yes...



#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" ;
}
}
}
}

}




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
Title: C++ Help
Post by: Boemann (nl) 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
Title: C++ Help
Post by: *MAFIA* Bonehead 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.
Title: C++ Help
Post by: Partyboy 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.
Title: C++ Help
Post by: *MAFIA* Bonehead 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.
Title: C++ Help
Post by: Partyboy on November 22, 2006, 04:04:03 PM
I just put it what you posted up there and i just kept getting that error.
Title: C++ Help
Post by: *MAFIA* Bonehead 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.
Title: C++ Help
Post by: Partyboy 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" ;
}

}
Title: C++ Help
Post by: Boemann (nl) 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?
Title: C++ Help
Post by: -<M>-Ricardo on November 23, 2006, 04:50:05 AM
bonehead can you change my  name please?
i want just Ricardo
thx
Title: C++ Help
Post by: Boemann (nl) 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
Title: C++ Help
Post by: -<M>-Ricardo on November 23, 2006, 05:12:27 AM
n o boeman please no ban !!!
Title: C++ Help
Post by: *MAFIA* Bonehead on November 23, 2006, 08:21:56 AM
You are damn close you just have an open and close in the wrong place ;)
Title: Idiot !!!
Post by: *MAFIA* PROHELIM@NKIE 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!!!!!!!
Title: C++ Help
Post by: -<M>-Ricardo on November 23, 2006, 09:10:34 AM
Thank you bonehead, I do not know why I have wanted to put MOFIA, but c nobody as first name!!
Title: C++ Help
Post by: Partyboy on November 23, 2006, 04:36:28 PM
Well ill close this since some prople are douches. And yeah Boeman Its hard but i sort of know how to make one.