Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 337

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 339

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 341

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 343
c++ error ??? :s

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Member jaggy's Avatar
    Join Date
    Jun 2007
    Posts
    34
    hey ,

    im trying a few stuff in c++ but if i try this it just wont seem to work :s
    could someone get out the errors pls ?


    #include <iostream>
    using namespace std;
    int main()
    {
    cout<<"Pleas tell me your name?"<<endl;
    char name;
    cin>>name;
    cout<<"Hello "<<name<<endl;
    cout<<"i saw u playing today,"<<endl;
    cout<<"u where playing a great fight..."<<endl;
    cout<<"Howmany kills u made in a row today ?"<<endl;
    cout<<"pleas insert a number."<<endl;
    int a;
    cin >> a;
    if(a = 1)
    {
    cout<<"1 kill isn't much"<<endl;
    }
    else
    cout<<"work in progress"<<endl;
    system("PAUSE"); return 0;
    }

    o ye btw this program should do :

    - ask for your name
    - dysplay your name with the text ...
    - ask u howmany kills in a row u made
    - tells u something from that amount ..

    errors :

    only dysplays 1 char
    doesnt even ask howmany kills in a row
    does tell u something but its not right -.-

  2. #2
    Semi-Coder
    Join Date
    Jun 2007
    Posts
    1,012

    Re: c++ error ??? :s

    Quote Originally Posted by jaggy View Post
    hey ,

    im trying a few stuff in c++ but if i try this it just wont seem to work :s
    could someone get out the errors pls ?


    #include <iostream>
    using namespace std;
    int main()
    {
    cout<<"Pleas tell me your name?"<<endl;
    char name;
    cin>>name;
    cout<<"Hello "<<name<<endl;
    cout<<"i saw u playing today,"<<endl;
    cout<<"u where playing a great fight..."<<endl;
    cout<<"Howmany kills u made in a row today ?"<<endl;
    cout<<"pleas insert a number."<<endl;
    int a;
    cin >> a;
    if(a = 1)
    {
    cout<<"1 kill isn't much"<<endl;
    }
    else
    cout<<"work in progress"<<endl;
    system("PAUSE"); return 0;
    }



    cout<<"work in progress"<<endl;
    system("PAUSE"); return 0; // i dont use system pause but i tink if u use that u dont need to use return but try return (0);
    and
    cout<<"Pleas tell me your name?"<<endl;
    char name;
    char = one letter

    try a break;

  3. #3
    VIP null's Avatar
    Join Date
    Apr 2006
    Posts
    1,796

    Re: c++ error ??? :s

    if(a == 1)

    not

    if(a = 1)

    also, it is

    else {

    not

    else


  4. #4
    Semi-Coder
    Join Date
    Jun 2007
    Posts
    1,012

    Re: c++ error ??? :s

    ahh i didnt catch that lol

  5. #5
    VIP
    Join Date
    Apr 2006
    Location
    AL, USA
    Posts
    185

    Re: c++ error ??? :s

    Quote Originally Posted by thor View Post
    char name;
    char = one letter
    Neg's comments should get you going, but Thor, you should know, a char isn't just one letter.

    A char is a simple array of characters.
    It can be as long as you want it to be.

    I.E.: "char[7] name = "Johnny";" or "char *buf = someStuff;"

  6. #6
    Member jaggy's Avatar
    Join Date
    Jun 2007
    Posts
    34

    Re: c++ error ??? :s

    ok ty guys gonna test it ^^

    but how to do int name then ?? ? ?? ? ? ? ?

  7. #7
    Coders Shard's Avatar
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    213

    Re: c++ error ??? :s

    Quote Originally Posted by SkyLine View Post
    Neg's comments should get you going, but Thor, you should know, a char isn't just one letter.

    A char is a simple array of characters.
    It can be as long as you want it to be.

    I.E.: "char[7] name = "Johnny";" or "char *buf = someStuff;"
    No, he's right. A char is just a single byte character, as you can see in the code there is no array or pointer declared.

    Replace
    Code:
    char name;
    with
    Code:
    char name[256];
    So you have an array of 256 characters to store the name in, as opposed to a single character.

    null, his else statement is correct, it just doesn't look it because the formatting is screwed up.

  8. #8
    Member jaggy's Avatar
    Join Date
    Jun 2007
    Posts
    34

    Re: c++ error ??? :s

    ye but i cant put in a number and i got a second prob with the calculator i need to make ...
    it just wont work correct

    #include <iostream>
    using namespace std;
    int main()
    {
    int y,x;
    cout << "Whats the first number ?"<<endl;

    cin >> y;

    cout << "Whats the second number?"<<endl;

    cin >> x;

    char todo;

    int a,d,m,s;

    cout << "What do you want to do? ( subbstract,divide,multiply,add)";

    cin >> todo;

    if (todo = a);
    {
    cout << y+x;
    }
    if (todo = s);
    {
    cout << y-x;
    }
    if (todo = m);
    {
    cout << y*x;
    }
    while (todo = d);
    {
    cout << y/x;
    }
    system("PAUSE");
    return 0;
    }

  9. #9
    Veteran Member
    Join Date
    Apr 2006
    Posts
    628

    Re: c++ error ??? :s

    Quote Originally Posted by jaggy View Post
    ye but i cant put in a number and i got a second prob with the calculator i need to make ...
    it just wont work correct

    #include <iostream>
    using namespace std;
    int main()
    {
    int y,x;
    cout << "Whats the first number ?"<<endl;

    cin >> y;

    cout << "Whats the second number?"<<endl;

    cin >> x;

    char todo;

    int a,d,m,s;

    cout << "What do you want to do? ( subbstract,divide,multiply,add)";

    cin >> todo;

    if (todo = a);
    {
    cout << y+x;
    }
    if (todo = s);
    {
    cout << y-x;
    }
    if (todo = m);
    {
    cout << y*x;
    }
    while (todo = d);
    {
    cout << y/x;
    }
    system("PAUSE");
    return 0;
    }
    sry but you need to learn to read the help given

    if (todo == a)

    not

    if (todo = a);

    Change the rest of your if and your while blocks. Also, ";" signifies the END of a statement, so your ifs and whiles won't work.

  10. #10
    Semi-Coder
    Join Date
    Jun 2007
    Posts
    1,012

    Re: c++ error ??? :s

    Quote Originally Posted by Shard View Post
    No, he's right. A char is just a single byte character, as you can see in the code there is no array or pointer declared.

    Replace
    Code:
    char name;
    with
    Code:
    char name[256];
    So you have an array of 256 characters to store the name in, as opposed to a single character.

    null, his else statement is correct, it just doesn't look it because the formatting is screwed up.
    :P thanks shard when i read that i was like??? im right ant i lol

Page 1 of 2 12 LastLast

Similar Threads

  1. Error
    By BlackGod in forum D3D
    Replies: 5
    Last Post: November 19th, 2008, 17:02
  2. Error?
    By Robbie-A-90-08 in forum Combat Arms Cheats
    Replies: 3
    Last Post: September 14th, 2008, 10:33
  3. Error? Please help
    By Agito in forum Combat Arms Cheats
    Replies: 6
    Last Post: August 27th, 2008, 09:13
  4. [ERROR] Enemy Territory error
    By lilandonaki in forum Enemy Territory Cheats
    Replies: 3
    Last Post: November 8th, 2007, 09:49
  5. ET error- recently new error that i have encountered
    By JohnnyD in forum Enemy Territory Cheats
    Replies: 10
    Last Post: July 10th, 2007, 01:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •