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 does it mean to take the address of a reference?

0 Answers   Amazon,


How to delete array of objects in C++? Proof by C++ code for proper deletion

0 Answers  


C++ Public access specifier instead of Private – What is bad ?

0 Answers  


What is Boyce Codd Normal form?

0 Answers   IBS,


What are Agilent PRECOMPILERS?

0 Answers   Agilent,






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

0 Answers   Accenture,


Write a program to read two numbers from the keyboard and display the larger value on the screen

1 Answers  


Difference between Call by pointer and by reference.

0 Answers   Adobe,


Define type casting in C++.

0 Answers   Amdocs,


What is RTTI and why do you need it?

0 Answers   Amazon,


How to input string in C++

0 Answers  


What is static variable and difference between(const char *p,char const *p,const char* const p).

0 Answers   Accenture,


Categories