if (inputFile)
{
while (true)
{
// read the file line by line and store it into appropriate variables
getline (inputFile, name);
getline(inputFile, street);
getline(inputFile, city);
getline(inputFile, state);
getline(inputFile, zipcode);
getline(inputFile, num);
getline(inputFile, weight);
if (!inputFile) break;
getline(inputFile, space);
but you need to string zipcode, num, and weight. Then you need to convert it back to an integer or double using
I had to go back and change every zipcode, num, and weight into its appropriate variable. With this I was able to see everyones' names in the correct format. I'm still having trouble figuring out how to calculate the total cost of all the postage for choice2.
The total is easy enough. I put a variable double total = 0.0; and then in the block where I calculated each person's postage put a line at the endtotal += postage; then you display the total at the end.
I had it where I could get everyone's name (excluding Ann, hers is still fully recorded) except for the first letter of their name. So close.
I wasn't able to display everyone's name. I put everything in the getline function like the others did, but like I said in my previous comment, you have to put everything into a string. To convert the values back into a integer for math algorithms use atoi and atof. http://www.cplusplus.com/reference/cstdlib/atoi/
You're going to also have to change all your values into the new value. For example:
1 2 3 4 5 6
string zipcode;
string num;
string weight;
int hello;
int hello2;
double hello3;
Replace stringed values with the new value. You don't have to change it in the cout statement because it doesn't have to be an integer.
I hope this helps! I'd like to thank everyone for helping us out. I finally got my code to work correctly.