Write a program to display the following output using a single cout statement
Maths=90
Physics=77
Chemistry = 69

Answers were Sorted based on User's Feedback



Write a program to display the following output using a single cout statement Maths=90 Physics=77 ..

Answer / hr

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{

char *sub[]={"Maths","Physics","Chemestry"};
int mark[]={90,77,69};
for(int i=0;i<3;i++)
{
cout<<setw(10)<<sub[i]<<setw(3)<<"="<<setw(4)<<mark[i]<<endl;
}
return 0;
}
Output:
Maths=90
Physics=77
Chemistry=69

Is This Answer Correct ?    0 Yes 0 No

Write a program to display the following output using a single cout statement Maths=90 Physics=77 ..

Answer / hr

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{

char *sub[]={"Maths","Physics","Chemestry"};
int mark[]={90,77,69};
for(int i=0;i<3;i++)
{
cout<<setw(10)<<sub[i]<<setw(3)<<"="<<setw(4)<<mark[i]<<endl;
}
return 0;
}
Output:
Maths=90
Physics=77
Chemistry=69

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

what do you mean by exception handling in C++?

0 Answers   Alter,


Explain about Searching and sorting algorithms with complexities

0 Answers   Accenture,


What are the advantages/disadvantages of using inline and const?

0 Answers   Amazon,


What are the advantages and disadvantages of B-star trees over Binary trees?

0 Answers  


Tell me about virtual function

1 Answers  






What is a virtual function in C++?

0 Answers   C DAC,


Write a C++ program to print strings in reverse order.

0 Answers   Amdocs,


Can we call C++ OOPS? and Why

0 Answers  


Write a program to input an integer from the keyboard and display on the screen “WELL DONE” that many times.

1 Answers  


It is possible to build a C++ compiler on top of a C compiler. How would you do this?

0 Answers   Amazon,


Explain why C++ is not purely Object Oriented Language

0 Answers   Aspire,


How does free know the size of memory to be deleted

0 Answers  


Categories