Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "memorygame.h"
using namespace std;
string sequence;
int randomsequence()
{
char full_alpha[27] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
cout << "You have 10 seconds to memorise the following list of words!" << endl;
for (int i = 0; i < 6; i++)
{
string c;
int random_number = rand() % 26; // generate a random number
c = 'a' + random_number; // Convert to a character from a-z
sequence += c;
}
cout << sequence << endl;
return 0;
}
void memorycheck(string &answer)
{
if (sequence == answer)
{
cout << "Well done! You have cooked a great meal! 20 pounds has been added to your account." << endl;
}
else if (sequence != answer)
{
cout << "Oh no! You have burnt all the food! This will be deducted from your wages." << endl;
}
}