Ok so I did this program, but I don't know what the problems are,the computer is supposed to generate a random 4 letter word ( not necessarily meaningful), and you have to input letters and if the letters are in the word it will tell you which one it is, and you should guess te word in the end, ok I'm a beginner and I think there are a lot of problems in it, but could you help me?
Line 6: change to #include <cstdlib>
Line 15: Why is your array vector so long, only needs to hold 4 characters.
Line 39: I think you can fix this one...?
I fixed it but It's still not what I'm looking for,
#include <iostream>
#include <conio.h>
#include <iomanip>
#include <ctime>
#include <fstream>
#include <stdlib.h>
using namespace std;
int count(char vector[]);
void search(char vector[]);
int main()
{
char vector [4];
char option;
srand (time(NULL));
for (int i=0; i<4; i++)
{
vector[i]= rand() % 26 + 65;
}
int A, word[4];
for (int i=0; i<4; i++)
{
word[i]=0;
}
for (int j=0; j<26 ;j++)
{
char letter;
cout << "Enter a letter in capitals" << endl;
cin >> letter ;
if (letter == vector [0])
word[0]= letter;
cout << letter;
if (letter == vector [1])
word[1]= letter;
cout << letter;
if (letter == vector [2])
word[2]=letter;
cout << letter;
if (letter == vector [3])
word[3]=letter;
cout << letter;
if ((word[0]!=0) && (word[1]!=0) && (word[2]!=0) && (word[3]!=0))
break;
}
for (int k=0;k<4; k++)
cout << word[k];
for (int i=0; i<4; i++)
{
cout << word[i];
}