I am working on a college project for C++ that gets a user to guess a letter. The letters of the alphabet are held in a string from a project file that was asked to be modified for the project.

I set the project file up very similar to that of another guessing game that I found coding for that gets the user to guess a number. I set up my code for this project to create a random number and assign the value to the letter string to get the letter. I know I haven't finished the calling for it yet.

The last few times I went to run the program it came up with over 30 errors most of them to my string comparisons to figure out if the user is correct.

Can anyone help me figure out how to fix these? I think I can figure out the calling afterwards if this is fixed.

These are the errors I have:

1>c:\course technology\83618-4\cpp5\chap12\ch12appe04 solution\ch12appe04 project\ch12appe04.cpp(42) : error C2082: redefinition of formal parameter 'x'
1>c:\course technology\83618-4\cpp5\chap12\ch12appe04 solution\ch12appe04 project\ch12appe04.cpp(43) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion)
1>c:\course technology\83618-4\cpp5\chap12\ch12appe04 solution\ch12appe04 project\ch12appe04.cpp(49) : error C2451: conditional expression of type 'std::basic_string<_Elem,_Traits,_Ax>' is illegal
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>c:\course technology\83618-4\cpp5\chap12\ch12appe04 solution\ch12appe04 project\ch12appe04.cpp(53) : error C2784: 'bool std:perator >(const std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem *)' : could not deduce template argument for 'const _Elem *' from 'int'
1>c:\course technology\83618-4\cpp5\chap12\ch12appe04 solution\ch12appe04 project\ch12appe04.cpp(57) : error C2784: 'bool std:perator <(const std::basic_string<_Elem,_Traits,_Alloc> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Alloc> &' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(130) : see declaration of 'std:perator <'
1>c:\course technology\83618-4\cpp5\chap12\ch12appe04 solution\ch12appe04 project\ch12appe04.cpp(57) : error C2676: binary '<' : 'std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
==========


This is what I have so far:


//Ch12AppE04.cpp
//Allows the user to guess a letter chosen
//randomly by the computer

#include <iostream>
#include <string>
#include <ctime>
#include <iomanip>
#include <stdlib.h>


using std::cout;
using std::cin;
using std::endl;
using std::string;


using namespace std;

string check (string guess, int x, int letter);

int main()
{
//declare variables
string letters [26] = {"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"};
string guess = "";
int letter = 0;
int x = rand();

//ask the user to guess a number
cout<<"Number: ";
cin>>guess;

cout<< check (guess, x, letter)<<endl<<endl;

return 0;
} //end of main function

int randomNum(int x, string letter)
{
int x = rand()%25;
cin >> letter [x] >> endl;
return x;
}

string check(string guess, int x, int letter){

if(guess=x)
{
cout << "You win, the letter is "<<x<< endl;
}
if(guess>x)
{
cout <<"The number is lower than "<<guess<< endl;
}
if(guess<x)
{
cout <<"The number is lower than "<<guess<< endl;
}




}//end of program