Thursday, July 9, 2009

C++ Help... I cant figure this one out.. Please help.?

#include %26lt;iostream%26gt;


#include %26lt;fstream%26gt;


using namespace std;





int main ()


{ double sum;


int count ;


int val;


ifstream infile;


char a,b,c;





infile.open ("p3_data.txt");


if (infile.is_open())


{


while (infile.good())


cout %26lt;%26lt; (char) infile.get();


infile.close();


}


else


{


cout %26lt;%26lt; "Error opening file\n";


}





cout %26lt;%26lt; "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=...


cout %26lt;%26lt; "\nPlease enter either A, B, or C to be calculated!\n";


cin %26gt;%26gt; a%26gt;%26gt;b%26gt;%26gt;c;


cout %26lt;%26lt; "\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...


cout %26lt;%26lt; "The bills add up to "%26lt;%26lt;endl;


system("pause");


return 1;


}


/*My program is only adding up 3 different things A B C. I can do everything else I just cant figure this one out. */


Thanks for the help








***A B C are three different groups with about 20 numbers in each group. I need to add the numbers and get an average. I need it to be able to print out like this


::package A 9.95 for 15 hours monthly. additional hours are $2.00 per hour





Please Help

C++ Help... I cant figure this one out.. Please help.?
Doesn't do anything that makes really sense. It just declares some variables (look at in variable definition), then opens a file and reads its records and close it, doing nothing with the information that reads (I need to double check the function to read a record is valid and works). Then it display some text on the screen "======" and "-- please enter, blah blah". Ask the user for 3 variables, a, b, c, that are of type charcter, be careful that can't enter more than just 1 character, display more text on the screen "======" and then says that "The bills add up to", the system enters into a pause until the user press any key, "press any key to continue..." is what (system ("pause")) is going to cause, and returns 1 as a result, it looks like is a function and it returns a numeric value. That's all it does but it doesn't make any sense, if it is a function to do something with sense, it hasn't been finished or it was put on purpose to just read what it does.
Reply:call a computer store


No comments:

Post a Comment