0

cout << "This " << "is " << "awesome!" ; cout << "This is awesome!"; I'm getting same result : then why we use extra angles<?

why we don't use once instead again and again...?

13th Jul 2018, 1:42 PM
raj
5 odpowiedzi
+ 2
Why did you use it? Its useless use of it. You can do this - cout <<"My Name is "<< name << " . I love coding". <<endl;
13th Jul 2018, 1:53 PM
Akib
Akib - avatar
+ 1
raj The reason you're getting the same results, is because you simply brokevdown the full statements into bits using "<<" The appropriate reason for using multiple << is when you want to inject the value of a variable into a statement Example ======== #include <iostream> using namespace std; int main(){ int age = 17; cout <<"I am "<<age<< " years old"; return 0; } Result ====== I am 17 years old Using multiple << to print an ordinary sentence is just a waste of time
13th Jul 2018, 2:00 PM
Dlite
Dlite - avatar
+ 1
I said its just a waste of time
13th Jul 2018, 2:03 PM
Dlite
Dlite - avatar
+ 1
ohh thanks a lot😍😍😍 you gave answer when I posted one more post at same time 🙏🙏🙏
13th Jul 2018, 2:03 PM
raj
0
you aren't understanding me I am saying that why the angle bracket are being used after every word instead we can do by putting only one time before the sentence
13th Jul 2018, 2:00 PM
raj