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 are Agilent PRECOMPILERS?

0 Answers   Agilent,


What is a virtual function in C++?

0 Answers   C DAC,


What is Boyce Codd Normal form?

0 Answers   IBS,


What is placement new?

1 Answers   Amazon,


How does stack look in function calls? When does stack overflow? What can you do to remedy it?

0 Answers   Adobe,






What is data abstraction? How is it implemented in C++?

0 Answers   Amdocs,


Consider the following C++ program

0 Answers  


How to input string in C++

0 Answers  


What does it mean to declare a member function as virtual in C++?

0 Answers   Amazon,


What is a class in C++?

0 Answers   Amazon, TCS, UGC Corporation,


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

0 Answers   Amazon,


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

0 Answers   Amazon,


Categories