C++ Need help

Discussion in 'Programming General' started by Ninja, May 4, 2014.

C++ Need help
  1. Unread #1 - May 4, 2014 at 12:57 AM
  2. Ninja
    Joined:
    Apr 2, 2013
    Posts:
    430
    Referrals:
    1
    Sythe Gold:
    1,190
    Discord Unique ID:
    197153264389718016
    Discord Username:
    Torrent25#7683
    Two Factor Authentication User RsProd Lawrence (2) Wait, do you not have an Archer rank? Extreme Homosex Potamus

    Ninja Silence Is Death
    Ninja Donor

    C++ Need help

    #include<iostream>
    using namespace std;
    int main()
    {
    do
    {
    cout<<"hello "<<endl;
    count++
    while(count<inputNum)


    system("pause");
    return 0;
    }


    could someone copy and post the correct syntax, and maybe tell me what iv done wrong?
     
  3. Unread #2 - May 4, 2014 at 5:37 AM
  4. kmjt
    Joined:
    Aug 21, 2009
    Posts:
    14,450
    Referrals:
    8
    Sythe Gold:
    449

    kmjt -.- The nocturnal life chose me -.-
    Banned

    C++ Need help

    You are missing a bunch of necessary semi colons and a brace.

    Code:
    #include<iostream>
    using namespace std;
    
    int main()
    {
        do
        {
            cout<<"hello "<<endl;
            count++; //missing semi colon
        } //missing brace
        while(count<inputNum); //missing semi colon
    
        system("pause");
        return 0;
    }
    
    1. You were missing a semicolon at the end of the line: count++
    2. You were missing the brace after the count++ line. Always have your braces in pairs. If you have an opening { brace, there must be a matching } brace.
    3. You were missing a semicolon at the end of the line: while(count<inputNum) (it is kind of weird form but for do-while loops in most languages you have to put the semicolon after the while statement at the bottom. It is not like a normal while loop where you do not have a semicolon.
     
  5. Unread #3 - May 4, 2014 at 11:18 AM
  6. Ninja
    Joined:
    Apr 2, 2013
    Posts:
    430
    Referrals:
    1
    Sythe Gold:
    1,190
    Discord Unique ID:
    197153264389718016
    Discord Username:
    Torrent25#7683
    Two Factor Authentication User RsProd Lawrence (2) Wait, do you not have an Archer rank? Extreme Homosex Potamus

    Ninja Silence Is Death
    Ninja Donor

    C++ Need help

    ok thanks
     
< Cant Play RS Classic on Mac? | Any objective c programmers here? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site