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

How to stop class inheritance in C++ with condition that object creation should be allowed

0 Answers  


Define an Abstract class in C++?

0 Answers  


Write a program that can take input from 3 to 8 and calculate the average?

0 Answers   Accenture,


Write a C++ Program to Reverse a Number using while loop.

1 Answers  


Write a program to read the values a, b and c and display x, where x=a/b–c. Test the program for the following values: (a) a = 250, b = 85, c = 25 (b) a = 300, b = 70, c = 70

1 Answers  






Is there a difference between class and struct?

0 Answers  


What is the difference between an ARRAY and a LIST in C++?

0 Answers   IBS, TCS,


How to run C++ program in cmd

0 Answers  


What is an abstract class?

5 Answers   Siemens,


When must you use a constructor initializer list?

0 Answers   Amazon,


Execute the qsort () in c/sort() in c++ library or your own custom sort which will sort any type of data on user defined criteria.

0 Answers   Adobe,


What are Agilent PRECOMPILERS?

0 Answers   Agilent,


Categories