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 is the difference between virtual functions and pure virtual functions?

1 Answers  


How will you execute a stack using a priority queue? (Push and pop should be in O (1)).

0 Answers   Adobe,


What does it mean to declare a function or variable as static?

0 Answers   Amazon,


Name the operators that cannot be overloaded.

1 Answers   Wipro,


What do you by Function Overloading in C++?

0 Answers   Akamai Technologies, Infogain,


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

0 Answers   Amazon,


What Are The Differences Between A C++ Struct And C++ Class?

2 Answers   Wipro,


There is a base class sub, with a member function fnsub(). There are two classes super1 and super2 which are sub classes of the base class sub.if and pointer object is created of the class sub which points to any of the two classes super1 and super2, if fnsub() is called which one will be inoked?

0 Answers   Alter,


Write a program that ask for user input from 5 to 9 then calculate the average

0 Answers   IBS,


What is conversion constructor in C++

0 Answers   TCS,


Can we use THIS Pointer in static function – Reason in C++?

0 Answers  


Tell us the size of a float variable.

0 Answers   Accenture,


Categories