Wow, your program needs help. I cleaned up what I could, but you still need to write the "int search()" function. If you need help with that, post again and somebody will probably help.
Code:
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
#define letters 5
int search(char word, int letterNum, char letter)
{
//YOUR SEARCH CODE HERE!
//example to return positive for letter #3 so the program will work:
return 3;
}
int main(void)
{
//YOU NEEDED SINGLE QUOTES AROUND THE LETTERS
char word[letters] = {'m', 'o', 'u', 's', 'e'};
char letter;
int location; //YOU NEED TO INITIALIZE location AS AN INT
int tries = 0; //THIS WILL COUNT YOUR TRIES
printf("choose a letter: ");
//USE A WHILE LOOP TO CONTINUTUE AND COUNT NUMBER OF TRIES:
while( tries < 6)
{
// YOU WERE MISSING A ; HERE, ALSO ADDED A SPACE BEFORE %c
scanf(" %c", &letter);
//YOU NEED TO WRITE THE FUNCION int search() SOMEWHERE AS WELL
location = search(*word, letters, letter);
if(letter == '*')
break;
else if(location >-1)
//YOU NEEDED TO CHANGE word TO letter AT THE END OF THIS printf()
printf("%c was found\ninput another character: ", letter);
else if(letter == '*')
break;
else
{
printf("inp98989898ut another character:");
++tries;//THIS WILL COUNT THE NUMBER OF WRONG TRIES
//MOVE THIS OUTSIDE THE ELSE-IF TO MAKE IT TOTAL TRIES
}
}
return 0;
}
good luck!