While loop / If statement

Write your question here.
I can get this while loop to do the right thing. I won't it to stop if the statement is false and cout the statement but it won't stop. Please help. I wanted to use the switch statement for tic tac toe as a function so all I would have to do is put the function object in main.

#include <iostream>
using namespace std;

struct Tictactoe{
char Y,N, people;

//void Startup(char y, char n);
void board();


};

int main(){

Tictactoe A;
int BPlayNGames, BPlayNGames2,y,n, people;

//BPlayNGames=BPlayNGames==1 ? 2:1;
//A.Startup(y,n);

cout<<"So you're here. Youz two reay to play the Ticah, Tacah, toeah game? \n"<<" If so please enter a Y; if not enter N\n\n";
char Y,N;

while(people ==y && people ==Y )
cout<<"Lets play. :-) \n\n\n";
if(people ==n && people ==N)
cout<<" Really..? You don't wanna play? Ahight if youz can't take the heat guess you gotta hop outta da kitchen. Well enjoy your day guys. :-)\n ";
cin>>people;


cout<< " Player 1 \n"<<" "<< "\n Enter a number and be quick about it will-yuh. \n\n\n";
cout<< " player 2 \n"<<" "<< "\n Your up, so enter a number and don't keep player 1 waitin for his turn; it's Tac, Tac, Toe geez...\n";
cin>>BPlayNGames;
cin>>BPlayNGames2;

A.board();
switch (BPlayNGames) {
case 0:
//cout<<square[0];

break;

default:
break;
}

return 0;
}
/*void Tictactoe::Startup(char y, char n){

cout<<"So you're here. Youz two reay to play the Ticah, Tacah, toeah game? \n"<<" If so please enter a Y; if not enter N\n\n";
while(y==Y && n==N)
if(people == y )
cout<<"Lets play. :-) \n\n\n";
else if(people == n)
cout<<" Really..? You don't wanna play? Ahight if youz can't take the heat guess you gotta hop outta da kitchen. Well enjoy your day guys. :-)\n ";
cin>>people;
}
*/
void Tictactoe::board(){
int square[10]={0,1,2,4,5,6,7,8,9,10};

cout<< square[0]<<" | "<< square[1]<< " | "<< square[2]<<" \n";
cout<<"__ ___ __"<<" \n\n";
cout<< square[3]<<" | "<< square[4]<< " | "<< square[5]<<" \n";
cout<<"__ ___ __"<<" \n\n";
cout<< square[6]<<" | "<< square[7]<< " | "<< square[9]<<" \n\n\n\n\n\n";
};
Last edited on
Try to use || instead of &&
Topic archived. No new replies allowed.