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


Please Help Members By Posting Answers For Below Questions

Is c++ free?

583


How the delete operator differs from the delete[]operator?

645


Should I learn c or c++ first?

569


Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?

2016


Are vectors passed by reference c++?

520






Is there a difference between class and struct?

490


What are the different types of comments allowed in c++?

581


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1659


What is the purpose of polymorphism?

683


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

803


Define 'std'.

610


Explain how overloading takes place in c++?

576


What is a virtual destructor? Explain the use of it?

553


What is prototype in c++ with example?

566


What is abstraction in c++ with example?

564