TCO 7 Create an output format statement which would generate

(TCO 7) Create an output format statement which would generate lines in the table which appear as shown below. The Element Name Field displays an element name contained in the name variable. YYY displays an integer value from the anum variable which ranges from 1 thru 109 and should be left justified. XXX.XXXX displays an atomic weight value from the aweight variable which ranges from 1.0000 to 268.0000 and should be right justified. Use the variables shown below in your output statements.

Element Name Field..YYY....XXX.XXXX

char name[15]; int anum; double aweight;

Solution

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
char name[15]; int anum; double aweight;

cin.getline(name,15);
cin>>anum>>aweight;

for(int i=0;i<strlen(name);i++)
cout<<name[i];
cout<<\" \"<<anum<<\" \"<<aweight<<endl;
}

(TCO 7) Create an output format statement which would generate lines in the table which appear as shown below. The Element Name Field displays an element name c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site