Hello, I am new to C++ but so far I love it! I've never programmed before but I am a computer science major and I am enjoying it so far. I had one question though that I can't seem to figure out. How to I make a cout result of an equation come out to be a fixed-point notation with two decimal points? I need to make sure the decimal point is always displayed. Here is the program I have written so far:
//This program will calculate the revenue earned from a sporting even
#include <iostream>
using namespace std;
cout << "How many tickets were sold in class A? \n"; //ask user to enter how many tickets were sold from an event
cin >> aSold;
cout << "Class b?\n";
cin >> bSold;
cout << "Class C?\n ";
cin >> cSold;
note that setprecision works for the total amount of numbers in the value (so not only for the decimals)... So if you want to show 270.00 you'll have to use setprecision(5);
Okay cool thank you Kaduuk have not had a chance to try it out yet been setting up new computer but I am going to get on it within the hour I'll let you guys know how it went