#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
cout << "Menu\n\n";
cout << "1 - 1 player\n";
cout << "2 - 2 player\n";
cout << "3 - High Scores\n";
cout << "4 - Exit\n\n";
int choice;
cout << "Choice: ";
cin >> choice;
switch (choice)
{
case 1:
cout << "Your the only one\n";
break;
case 2:
cout << "2 players it is.\n";
break;
case 3:
cout << "High scores.\n";
break;
default:
cout << "You made an illegal choice.\n";
}
system("PAUSE");
return 0;
}
///but with this it will only show one line of text. but what i want it to do is option one is play the game that i made ///with only one player. then option 2 have it play with two players. and now for my high scores i have this...
// High Scores
// Demonstrates algorithms
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
vector<int>::const_iterator iter;
cout << "Creating a list of scores.";
vector<int> scores;
scores.push_back(1500);
scores.push_back(3500);
scores.push_back(7500);
cout << "\nHigh Scores:\n";
for (iter = scores.begin(); iter != scores.end(); ++iter)
cout << *iter << endl;
cout << "\nFinding a score.";
int score;
cout << "\nEnter a score to find: ";
cin >> score;
iter = find(scores.begin(), scores.end(), score);
if (iter != scores.end())
cout << "Score found.\n";
else
cout << "Score not found.\n";
cout << "\nRandomizing scores.";
srand(time(0));
random_shuffle(scores.begin(), scores.end());
cout << "\nHigh Scores:\n";
for (iter = scores.begin(); iter != scores.end(); ++iter)
cout << *iter << endl;
cout << "\nSorting scores.";
sort(scores.begin(), scores.end());
cout << "\nHigh Scores:\n";
for (iter = scores.begin(); iter != scores.end(); ++iter)
cout << *iter << endl;
return 0;
}
at which i only know how to make it that the scores are already there. But i want it to have it to were i can enter the players high scores while in the game.
then last but not least option four is end the game which i alread have that on the options menu.
so if any one can help me piece all these individual programs together id greatly appreciate it.
This post has been edited by JackOfAllTrades: 25 September 2010 - 01:04 PM
Reason for edit:: Added code tags.

New Topic/Question
Reply




MultiQuote





|