Texas A&M University CS Data Structures Project
I need help if my code is right and how to runGame() that calls the functiongetLetter() and takes the user guess to run the game.
/**
Filename: GuessMyLetter.cpp
Author:
Date last modified: 9/9/2021
This program simulates the computer guessing game.
*/
#include
#include “time.h”
using namespace std;
void getLetter(char aplh[],int n)
{
char alph[27] =
{
‘0’, ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’
}
;
int V = 21;
}
int getPosition()
{
int position = 1 + (rand() % 26);
return position;
cout << "I am thinking of a letter. What is your letter? ";
while(true);
{
int guess;
cin >> guess;
if (guess == position)
{
cout << "Congratulations you guessed my letter." << endl;
} else if (guess < position)
{
cout << "Your guess is too low" << endl;
}
else (guess > position);
{
cout << "Your guess is too high" << endl;
}
}
}
void runGame() {
}
int main(void)
{
cout << RAND_MAX << endl;
srand((unsigned)time(NULL));
int RND;
cout << rand() << endl;
for (int i = 0; i < 11; i++)
{
RND = getPosition();
cout << RND << "\t";
}
/*end for*/
system(“pause”);
return 0;
} /**
Filename: GuessMyLetter.cpp
Author:
Date last modified: 9/9/2021
This program simulates the computer guessing game.
*/
#include
#include “time.h”
using namespace std;
void getLetter(char aplh[],int n)
{
char alph[27] = { ‘0’, ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’};
int V = 21;
}
int getPosition() {
int position = 1 + (rand() % 26);
return position;
cout > guess;
if (guess == position)
{
cout
Top-quality papers guaranteed
100% original papers
We sell only unique pieces of writing completed according to your demands.
Confidential service
We use security encryption to keep your personal data protected.
Money-back guarantee
We can give your money back if something goes wrong with your order.
Enjoy the free features we offer to everyone
-
Title page
Get a free title page formatted according to the specifics of your particular style.
-
Custom formatting
Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.
-
Bibliography page
Don’t pay extra for a list of references that perfectly fits your academic needs.
-
24/7 support assistance
Ask us a question anytime you need to—we don’t charge extra for supporting you!
Calculate how much your essay costs
What we are popular for
- English 101
- History
- Business Studies
- Management
- Literature
- Composition
- Psychology
- Philosophy
- Marketing
- Economics