04-24-2011, 06:05 PM
Dear student!
cout<<"the digit is:"<<digit<<'/n'; is a single statement. Its meaning is to print "the digit is _____" and go to next line in output screen.
Blank is filled with the value present in digit mentioned after second extraction operator.
Let say 8 is stored in digit mentioned after second extraction operator. Then output would be
the digit is 8
As we have written \n. so after printing this line cursor would move to next line.
If we write
cout<<"the digit is:";
cout<<digit;
cout<<'/n';
These are three cout statements and it will print only "the digit is" .
It will terminate then because it will consider second line an other cout statement containing error because if it is cout statement then it must be written as cout<<"digit";
So correct way is to write
cout<<"the digit is:"<<digit<<'\n';
There are different development environments for programming. One is turbo C which you have used in ICS. Dev-C++ is an other programming environment for C++. which is used in this course. Both have its own advantages.
cout<<"the digit is:"<<digit<<'/n'; is a single statement. Its meaning is to print "the digit is _____" and go to next line in output screen.
Blank is filled with the value present in digit mentioned after second extraction operator.
Let say 8 is stored in digit mentioned after second extraction operator. Then output would be
the digit is 8
As we have written \n. so after printing this line cursor would move to next line.
If we write
cout<<"the digit is:";
cout<<digit;
cout<<'/n';
These are three cout statements and it will print only "the digit is" .
It will terminate then because it will consider second line an other cout statement containing error because if it is cout statement then it must be written as cout<<"digit";
So correct way is to write
cout<<"the digit is:"<<digit<<'\n';
There are different development environments for programming. One is turbo C which you have used in ICS. Dev-C++ is an other programming environment for C++. which is used in this course. Both have its own advantages.
