# Thread: if this is one statement then why we are using << again and again . what will happen

1. ## if this is one statement then why we are using << again and again . what will happen

Dear Sir,

you said before that cout<<"the digit is:"<<digit<<'\n';

i have confusion in this statement. if this is one statement then why we are using << again and again . what will happened if

cout<<"the digit is:";

cout<<digit;

cout<<'\n';

and what will happened if we shall use << one time like cout<<"the digit is :" digit '\n;

and also in ICS i have studied c but that time we use blue screen for source code and black screen for run and both were there in the same window. i am confuse in these all like devc++, c++, c, c sharp. and what was that C++. and also we did not use there CMD and programms were running..

please sir explain in detail. i am so worry because assingment date is very close.

thank you very much

2. 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.