+ 1
I need to write a prohram that prompts user for his income and display the result on the screen.
The first part asks for his income. There is a \t before the phrase "Your monthly income and a single space after ':'. So you have " Your monthly income is: " The user needs to provide his or her income as a float. The next part is to display the result to the screen. So you have something like "Your income is: $ 1010.99" //Output should look like this... Your monthly income: 1010.99 Your income is: $ 1010.99. There needs to be one space between the colon and the dollar sign. The money is right alligned to 9 spaces from the dollar sign. Can anyone help with this, please????
19 odpowiedzi
+ 4
Updated
And when you run the code, you type the value. It will update to that value.
+ 4
Updated
+ 3
Your code???
It is suggested to try by yourself and if you get some error, you post the code here... And we can help you then...
+ 3
See this
Enter income value.
https://code.sololearn.com/cbyEj1sbBFqw/?ref=app
+ 3
What do you mean?
Give an example...
+ 2
You are a boss.
+ 2
Yes.
+ 2
Can I get to know you more?
+ 1
Ok, I am not with my laptop.... So when I get back home, I will post the errors instead.
I basically have issues translating the errors I get
+ 1
This is the code and the errors...
+ 1
#include <iostream>
using namespace std;
int main() {
int monthlyIncome;
floatmonthlyIncome = 1010.99;
cout <<"\tYour monthly income: " <<endl;
cin >> monthlyIncome;
cout <<"Your monthly income is: quot;;
cout << monthlyIncome << endl;
return 0;
}
+ 1
So please, what am I doing wrong???
+ 1
Thank you so much.....
+ 1
What if I want the output to display a digit, where do I insert that
+ 1
Unlike the output of your code, it displays:
Your monthly income:
Your monthly income is: $ 0
+ 1
I want to add a value there instead of $0
+ 1
Also, you know I could also choose to use setw() instead of .width.....
+ 1
If setw() was my choice, how would I input it???
+ 1
You just saved my life..