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
Is c++ free?
How the delete operator differs from the delete[]operator?
Should I learn c or c++ first?
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
Are vectors passed by reference c++?
Is there a difference between class and struct?
What are the different types of comments allowed in c++?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
What is the purpose of polymorphism?
Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c
Define 'std'.
Explain how overloading takes place in c++?
What is a virtual destructor? Explain the use of it?
What is prototype in c++ with example?
What is abstraction in c++ with example?