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 ?    1 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 does stack look in function calls? When does stack overflow? What can you do to remedy it?

1 Answers   Adobe,


What is C++11?

2 Answers   Adobe,


What Is A Default Constructor in C++ ?

1 Answers   Amazon,


What kind of problems does name mangling cause?

1 Answers   Amazon,


Define type casting in C++.

1 Answers   Amdocs,


To solve the 8 Queens problem, which algorithm is used?

1 Answers   Accenture,


Write a C++ Program to find Addition of Two Numbers.

1 Answers  


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

1 Answers   Amazon,


How can a C function be called in a C++ program?

1 Answers  


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

1 Answers  


How do you write a function that can reverse a linked-list in C++?

1 Answers   IBS,


Explain encapsulation in C++.

1 Answers   Verifone,


Categories