Write a program to display the following output using a single cout statement
Maths=90
Physics=77
Chemistry = 69
Answer Posted / 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 View All Answers
What is #include iomanip?
What will the line of code below print out and why?
Can you use the function fprintf() to display the output on the screen?
How to invoke a C function using a C++ program?
What are move semantics?
What is the problem with multiple inheritance?
Why do we use string in c++?
What is std :: endl?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
How do you define a class in oop?
Where the memory to the static variables is allocated?
What is the full form of india?
What is encapsulation in c++ with example?
What is solid in oops?
How a new operator differs from the operator new?