C++ statistics project?
-
I have just done a small statistics displaying program for a small past time project. However just coudn't get it to compile anything missing, I suspect its the declarations. #include <iostream> #include <string> using namespace std; int main; const int ORE_PIECES = 500; int soldiers, KIA, survivors; string commander; //get the information cout << "Welcome to Combat Statistics\n\n"; cout << "Plese enter the following for personalised combat exterince\n"; cout << "Enter a number"; cin >> "soldiers"; cout << "Enter a number, lower than the first: "; cin >> KIA; survivors = soldiers - KIA; cout << "Enter your last name: "; cin >> commander; //tell the story cout << "\nA able squad of " << soldiers << " set out on a mission "; cout << "-- in search of the lost ore of the enemy. "; cout << "The squad was led by the legendary commander, " << commander << ".\n"; cout << "\nAlong the way, a band of guns wielding militants ambushed the squad. "; cout << "All squad members fough courageously under the command of " << commander; cout << ", and the militants were killed, but at a cost. "; cout << "Of the soldiers, " << KIA << " were declared eliminated, "; cout << "leaving just " << survivors << " in the squad.\n"; cout << "\nThe squad was about to give up all hope "; cout << "But whilwe laying the deceased to rest, "; cout << "they stumbled upon the lost ore. "; cout << "So the adventurers split " << ORE_PIECES << " ore pieces."; cout << commander << " held on the extra " << (ORE_PIECES % survivors); cout << " pieces to keep things fair of course.\n"; return 0; }
-
Answer:
you had couple of syntax errors corrected now . main should not have ; after and soldiers is a variable so you dont need to put it between "" #include <iostream> #include <string> using namespace std; main() { const int ORE_PIECES = 500; int soldiers, KIA, survivors; string commander; //get the information cout << "Welcome to Combat Statistics\n\n"; cout << "Plese enter the following for personalised combat exterince\n"; cout << "Enter a number"; cin >> soldiers; cout << "Enter a number, lower than the first: "; cin >> KIA; survivors = soldiers - KIA; cout << "Enter your last name: "; cin >> commander; //tell the story cout << "\nA able squad of " << soldiers << " set out on a mission "; cout << "-- in search of the lost ore of the enemy. "; cout << "The squad was led by the legendary commander, " << commander << ".\n"; cout << "\nAlong the way, a band of guns wielding militants ambushed the squad. "; cout << "All squad members fough courageously under the command of " << commander; cout << ", and the militants were killed, but at a cost. "; cout << "Of the soldiers, " << KIA << " were declared eliminated, "; cout << "leaving just " << survivors << " in the squad.\n"; cout << "\nThe squad was about to give up all hope "; cout << "But whilwe laying the deceased to rest, "; cout << "they stumbled upon the lost ore. "; cout << "So the adventurers split " << ORE_PIECES << " ore pieces."; cout << commander << " held on the extra " << (ORE_PIECES % survivors); cout << " pieces to keep things fair of course.\n"; return 0; }
StanZero at Yahoo! Answers Visit the source
Related Q & A:
- Which should be used after messing up clustered index? Update statistics, Reindex or Reorganize?Best solution by Database Administrators
- How do you convert an Android project to a maven project manually?Best solution by Quora
- How to learn C# (moving from C++ to C#?Best solution by stackoverflow.com
- How to retrieve Install Statistics from the Google Developer's Console?Best solution by Stack Overflow
- Where can I find statistics for American prisons?Best solution by bop.gov
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.