Turbo C++ Basic Loop Statement Errors & Warning

hey guys, i got an errors and 1 warning, how could i correct my codes, i need your help thanks, i am new to this forum btw.


code used:

#include <iostream.h>
#include <conio.h>
main()
{
clrscr();
int counter;
cout<<"Please enter a number and allow the program to keep track of how many times: ";
cin>>counter;
for(int input=1;input<counter;input++)
{
cout<<"Number: "<<input<<endl;
}
cout<<"Number: "<<input<<" is the last number sir!!!"<<endl;
getch();
return 0;
}

Result (Image Preview)
http://i.imgur.com/7CUm3BS.jpg
Last edited on
The code you have put here is not the same as the code in your screenshot. That said, some errors I see:

iostream does not have a .h on the end of it.
#include <iostream>

main must return an int:
1
2
int main()
{//... 


conio.h is very old and platform specific, so I would not suggest using it. This means not using things like clrscr() or getch(), but you shouldn't be clearing the screen and you should be using the standard IO stream cin anyway.

I believe Turbo C++ is quite an old IDE/compiler, so I would suggest getting a new one such as VC++ (Microsoft's C++ IDE).
Last edited on
can i used Dev C++ sir?

anyway let me try the guide you suggest sir. .thank you sir.
Topic archived. No new replies allowed.