-
June 22nd, 2011, 05:00 PM
#1
i feel stupid c++
[code]
cout<<setw(5)<<"ID#"<<setw(5)<<" "<<left<<setw(15)<<"CATEGORY "<<right<<setw(16)<<"Earned"<<endl;
cin>>idnum;
while(!cin.eof())
{
cin>>code;
cout<<fixed<<showpoint<<setprecision(2);
if(code == 'm' || code == 'M')
{
cin>>salary;
cout<<setw(5)<<idnum<<setw(5)<<" "<<left<<setw(15)<<"Manager"<<"$"<<right<<setw(15)<<salary<<endl;
}
cin>>idnum;
}
return 0;
}
[code]
i want this
ID# CATEGORY EARNED
10051 Manager $ 500.00
but im getting some weird stuff like this any help
ID# CATEGORY Earned
4.86395e-27010025 Manager $ 5.0e+02
-
June 23rd, 2011, 01:38 AM
#2
Re: i feel stupid c++
Originally Posted by ryamjones
...
i want this
ID# CATEGORY EARNED
10051 Manager $ 500.00
but im getting some weird stuff like this any help
ID# CATEGORY Earned
4.86395e-27010025 Manager $ 5.0e+02
Well, you cannot get "EARNED" just because you output "Earned".
And what are idnum and salary?
PS if you debugged your code you, perhaps, already would have got the answer on your problems...
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|