I am trying to create a program that only adds the distance of the feeder if all of the feeder "attributes" are the same (except for the distance). If the attributes are not the same, I want to append onto the output file, but if the attributes match with a feeder that is already stored in the output file, I want it to just add the distance to that matching feeder and keep the other data already being stored in the file. Please help!
if (menu3 == 'Y')
{
cout << "\n";
system("pause");
}
else if (menu3 == 'N')
{
cout << "\nWould you like to re-enter the data (Y or N)?\n";
cin >> menu4;
menu4 = toupper(menu4);
if (menu4 == 'Y')
{
goto start;
}
else
{
cout << "Program will now close. ";
system("pause");
}
}
cout << "Your data has been saved to \"" << fileName << "\"\n";
cout << "Would you like to add another feeder (Y or N)?\n";
cin >> menu2;
menu2 = toupper(menu2);
} while (menu2 == 'Y');
}
I may or may not look at this later, depends if I am still busy, but it would be more help to other forum members reading this if you gave more information as to what exactly is going wrong -- not just a source code dump.
- What is your input? If it's a file, show us the file.
- What is your expected output?
- What is your actual output?
Those three things are the basis for how people make unit tests for their code.
Side note: main() should not be recursive, this should be refactored into a loop. It's technically against the standard, but probably not the source of your problem. (You also have a LOT of repeated code patterns that could be shortened a lot using for loops and arrays)
Sorry, this is my first time posting to this forum, and I'm also fairly new to C++. The inputs for this program are distance, conduitNum, conduitSize, conduitType, conductorNum, conductorSize, conductorType, and groundSize. I want the program to prompt the user for this information and then compare all of those attributes to those that were previously entered. If every attribute (besides distance) matches, I want it to add the new distance and previous together and save it to a file. I am able to get the program to do this only if I consecutively enter the same attributes, but if the similar attributes are not entered consecutively, the program overwrites the stored data onto the output file.
I know that this might sound a bit confusing, but I'm trying the best I can to explain it.