I need to write a prohram that prompts user for his income and display the result on the screen. | SoloLearn: Learn to code for FREE!

+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????

5/7/2019 5:58:37 AM

joshua olaoye olatunbosun

19 Answers

New Answer

+4

Updated And when you run the code, you type the value. It will update to that value.

+4

+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

+2

+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: $"; 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..