Programming Homework Help. Texas A&M University CS Data Structures Project
I need help if my code is right and how to runGame() that calls the function
getLetter() 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 <iostream>
#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;
}