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

Write a C++ Program to find Square Root of a number using sqrt() function.

1 Answers  


What do you by Function Overloading in C++?

0 Answers   Akamai Technologies, Infogain,


Is there a difference between class and struct?

0 Answers  


Can we provide one default constructor for our class?

0 Answers  


How to convert integer to string in C++

0 Answers  


What is a memory leak in C++?

0 Answers   Agilent,


What do you know about Volatile keyword in C++? Explain with an example code.

0 Answers   Adobe,


What are issues if we mix new and free in C++?

0 Answers  


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

0 Answers   Amazon,


What is name mangling/name decoration?

0 Answers   Amazon,


What is the purpose of a constructor? Destructor?

0 Answers   Amazon,


Explain about Searching and sorting algorithms with complexities

0 Answers   Accenture,


Categories