Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

help using getline compared to input

$
0
0
Hey there, my code is nearly perfect, but I need help with my input for a value. here's the snippet of my code:

cout << setw(15) << right <<"$" ;
			double Amount;
			input >> Amount;
			cout.setf(ios::showpoint);
			cout.setf(ios::fixed);
			cout.precision(2);
			cout.width(8);		
		input.ignore();
    	cout << Amount << endl;



i know that input puts a space after itself, and thats throwing off my output, how would i use getline instead of input?

** side note, im doing this on an online compiler, and its difficult to make changes (intellisense doesn't kick in)

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>