I made a simple color finding game. the problem is that my color input guess is not good so complex I want them in one line and also I want to see my tries at certain places. can you help me
thanks in advance.

#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cctype>
#include <conio.h>

using namespace std;

int main(int argc, char *argv[])
    int j;
    int trial=0;
    int counters=0;
    int color_correct=0;
    string guess[4];    
    vector <string> colors;
   cout << "\t \t \t Find the colors in order.\n\n ";
   cout << "\n there are six available colors which are yellow,red,green,black,blue,white \n";
   cout << "\n pls select 4 and find their places\n \n ";
     while (counters != 4 )
     {  counters=0;  
   for ( int j=0;j<4;j++)
       cout << "\n"<<j+1<<". color=\n\n";
       cin >> guess[j];
       cout <<"\n";
 for (int j=0;j<4;j++)
 for (int i=0;i<4;i++)
     if (colors[j] == guess[i])

      for ( int j=0;j<4;j++)
      if (colors[j] == guess[j])
       cout << trial<<".try  ";
        for ( int j=0;j<4;j++)
       cout << guess[j]<<"\t";       
     cout << " \n \n you know "<< color_correct<< "  colors \n";   
    cout << " you know "<< counters<< "  colors in order\n";
   cout <<" you guessed all correct.";           

Can you explain what you are trying to do a bit more. I ran the program and didn't understand what I was trying to do. Looking at the code, you read 4 colors from the command line, then you try to compare the input colors to the ordered list of colors you hard coded? I don't get the point?

Also, you should use compare() to compare strings:


So the easiest thing for you todo is make this into classes. I'm guess you don't know about classes that much. So the next best thing you can do is make this into functions.

Here is a brief skeleton.

//#include everything
int main(){
 const int MAX_COLORS_TO_GUESS = 4;
 string guessColors[MAX_COLORS_TO_GUESS] = { "yellow","green"...and so on };
 std::vector<string> correctColors(guessColors,guessColors + MAX_COLORS_TO_GUESS);
 int correctColorsGuessed = 0;
 int correctPositionOfCorrectColorGuessed = 0;
 int numberOfTries = 0;
 while(correctColorsGuessed != MAX_COLORS_TO_GUESS && correctPositionOfCorrectColorGuessed != MAX_COLORS_TO_GUESS ){
   std::vector<string> userGuessedColors = getUserGuessedColors();
   correctColorsGuessed = getCorrectColorsGuessed(correctColors,userGuessedColors);
   correctPositionOfCorrectColorGuessed = getNumberOfCorrectPosition(correctColors,userGuessedColors);
 printInformation(numberOfTries,..and more stuff if you need it);

This seems like the mastermind game? Now all you have to do is implement the needed
functions. Make sure they are simple. If they get complicated, then break the function into sub-functions.