• Log in or sign up for an account here: https://www.sythe.org/login

C++ need help

Status
Not open for further replies.

Ninja

Silence Is Death

Ninja Donor
Joined
Apr 2, 2013
Sythe Gold
1,190
Messages
430
Location
Australia
Extreme Homosex
Lawrence
Potamus
RsProd
Two Factor Authentication User
Wait, do you not have an Archer rank?
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?
 
arg-highlightedPosts="Array" args="" /> arg-highlightedPosts="Array" args="" />
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//
 
arg-highlightedPosts="Array" args="" /> arg-highlightedPosts="Array" args="" /> arg-highlightedPosts="Array" args="" />
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top