This project has moved. For the latest updates, please go here.

Turbo C++ peculiar issue

Mar 20, 2016 at 11:37 AM
Hi
I installed Turbo C++ and was just trying a simple program to print a nmber that I enter. It does print a different number, regardless of what I enter.

/program to find add and sub of two numbers/

include <iostream.h>

include <conio.h>

void main()
{
clrscr();
int a;
cout<<"enter the number";
cin>>a;
cout<<"you entry"<<a;
cout<<"add"<<(a+a);
getch();
}

Can I get some help.. Not sure if I am missing something very obvious or something to do with installation etc
Apr 29, 2016 at 1:31 PM
Hi - I ran your code and found a few mistakes that may have been with the code paste into the forum
I have corrected these error as follows
//program to find add and sub of two numbers/
// note comments need 2 slashes at front
#include <iostream.h>
#include <conio.h>
// include needs a # infront
void main()
{
clrscr();
int a;
cout<<"enter the number to double :";
cin>>a;
cout<<"you entered "<<a << endl;
// put spaces after your text
// use << endl; to get new line
cout<<"result ="<<(a+a) << endl;
getch();
}