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 Check Whether a character is Vowel or Consonant.

2 Answers  


What is the 4 difference between delete[] and delete?

0 Answers   Alter,


Discuss about iteration statements in C++ .

0 Answers   Agilent,


What is the difference between public, private, and protected inheritance?

0 Answers   Amazon,


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

1 Answers  


What is pass by value & reference.

0 Answers   Accenture,


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

0 Answers   Accenture,


How can you force the compiler to not generate them?

0 Answers   Amazon,


What does it mean to take the address of a reference?

0 Answers   Amazon,


What is a constructor initializer list?

0 Answers   Amazon,


What is constant keyword in C++? Illustrate its various uses.

0 Answers   Akamai Technologies, Infogain,


What's the value of the expression 5["abxdef"]?

0 Answers  


Categories