C++ need help

Discussion in 'Homework Help' started by Ninja, May 4, 2014.

Thread Status:
Not open for further replies.
C++ need help
  1. Unread #1 - May 4, 2014 at 12:58 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 please copy and write the correct syntax, and maybe even tell me what iv done wrong?
     
  3. Unread #2 - May 4, 2014 at 8:31 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

  5. Unread #3 - Oct 20, 2014 at 7:56 PM
  6. Korasi
    Joined:
    Jan 7, 2011
    Posts:
    603
    Referrals:
    1
    Sythe Gold:
    3

    Korasi Forum Addict
    Banned

    C++ need help

    I think I'm kinda late on the response :p but anyway;

    From what I remember, you have to declare and initialise your variables. Also, you're missing some syntax stuff. I think this should work:

    #include<iostream>
    #include<stdio.h>
    #include<conio.h>
    #include<windows.h> //I added stdio, conio, and windows. not sure if they're necessary, but I used to use them.//
    using namespace std;
    int main(){
    int count=0;
    int inputNum=0;

    cout<<"Please enter any number: "<<endl;
    scanf("%d", &inputNum);

    do{
    cout<<"hello "<<endl;
    count=count+1; //same as count++//
    }
    while(count<inputNum);


    system("pause");
    return 0;
    } //closes main//
     
  7. Unread #4 - Oct 21, 2014 at 2:11 PM
  8. Shin
    Joined:
    Mar 10, 2007
    Posts:
    14,171
    Referrals:
    23
    Sythe Gold:
    196
    Discord Unique ID:
    777373911821713408
    Pool Shark (4) Village Drunk <3 n4n0 (29) Battleship Champion

    Shin Join the Sythe.org Discord
    Retired Administrator Legendary Mudkips $100 USD Donor

    C++ need help

    Code:
    #include <iostream>
    using namespace std;
    
    int main (){
    
        int count    = 0;
        int inputNum = 0;
    
        cout << "Enter a number: ";
        cin  >> inputNum;
    
        do {
           cout << "Hello.\n";
           count++;
        } while (count < inputNum);
    
        return 0;
    }
     
  9. Unread #5 - Oct 21, 2014 at 11:20 PM
  10. -Ryan
    Joined:
    Aug 15, 2010
    Posts:
    6,182
    Referrals:
    3
    Sythe Gold:
    996
    Discord Unique ID:
    470294579980140545
    Discord Username:
    -Ryan#2126
    Two Factor Authentication User In Memory of Jon Heidy Summer 2016 STEVE (3)

    -Ryan Make Sythe Great Again!
    Retired Global Moderator $100 USD Donor New

    C++ need help

    Answered.
     
< Need help quick | >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site