PLEASE HELP....
I was wondering if someone could help me. I am taking a programming class and I am having alot of problems. When I began my class we were given a copy of Visual Studio 2003. I had alot of problems with it and when I would go to build everything would be fine. When I would click to start without debugging was the problem. At the beginning it asks you if you wish to continue but the code does not log off the program when you enter 'n' for some reason. When it goes to enter name of troop it works fine, but then it ends right there. It won't go any farther for some reason. So I downloaded a copy of Visual Studio 2005 and still no luck. I am supposed to be writing a summer fundraiser program for a Boy Scout troop. Each troops fundraising is done on a bonus program. For 300 cans they get 10 points, 301-600 they get 15 points, and 601 and up are 20 points. I can't figure out the code to tally the number of readers, total number of the cans, total number of bonus points, average number of cans, average number of points, and the highest number of points to a single troop.
I am having the hardest time in this class and it is the last class I need to finish. Please someone help??
#include <iostream> using std::cin; //you probably dont need this because of using namespace std; using std::cout; //or this using std::endl; //or this using namespace std; int main(int argc, char *argv[]) { string scout; int cans; //receive first scout name or end to exit program cout << "Enter the name of the scout. Otherwise type end to exit the program." << endl; cin >> scout; while ( scout != "end" ) { cout << "enter the the number of cans" << endl; cin >> cans; /* here comes the code which add the cans to some total or write it to a file or something for a given scout whom had his name entered. */ //enter next value which could be the sentinel cout << "Enter the name of the scout. Otherwise type end to exit the program." << endl; cin >> scout; } //after all the cans are entered //average cans = total number of cans divided by number of scouts //and all other code including display the output. system("PAUSE"); return EXIT_SUCCESS; }
| DaniWeb Message | |
| Cancel Changes | |