We have used the extraction operator << repeatedly in the two statements for printing results. The statement
cout<<”Total Value is =”<
Cout<<”Total Value is=”<
Total Value is = 15
Average = 7.5
If you want one line of output, the statement will be;
Cout<<”Total Value is=”<
Total Value is = 15 Average = 7.5
We can also cascade input operator >> as shown below
cin>>n1>>n2>>;
The values are assigned from left to right. That is, if we key in two values, say, 15 and 24 then 15 will be assigned to n1 and 24 will be assigned to n2.
No comments:
Post a Comment