1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#include<iostream>
#include<iomanip>
#include<windows.h>
#include <conio.h>
#include <stdlib.h>
using namespace std;
int loop, side, i, j;
int fail1 = 1, fail2 = 1;
string dots[200] = {"| ...|", "| ... |", "| ... |", "| ... |", "|... |"};
string f1dot[200] = {"| ..|", "| .. |", "| .. |", "| .. |", "| .. |", "|.. |"};
string f2dot[200] = {"| .|", "| . |", "| . |", "| . |", "| . |", "| . |", "|. |"};
void clrscr(){system("cls");}
void checklvl2()
{
//At this point fail1 and fail2 = 1
if ((j = (i - 1)) || (j = (i + 1))) {fail1 = 0;} // changes fail1 to 0
if ((j = (i + 2)) || (j = (i - 2))) {fail2 = 0;} // also changes fail2 to 0
if (fail1 == 0) {cout << "fail1";} // both return true???
if (fail2 == 0) {cout << "fail2";}
}
void level2()
{while (!_kbhit()){
for (loop = 0; loop <5; loop++)
{
if (!_kbhit()){
clrscr();
cout << "________\n";
for (side = 1; side <=11; side++)
{cout << "| |\n";}
cout << dots[loop]<<endl;
cout << dots[i]<<endl;
cout << "---------";
j = loop;
cout << i<<" ";
cout << j;
Sleep(500);}}
for (loop =3; loop >= 1; loop--)
{
if (!_kbhit()){
clrscr();
cout << "________\n";
for (side = 1; side <=11; side++)
{cout << "| |\n";}
cout << dots[loop]<<endl;
cout << dots[i]<<endl;
cout << "---------";
j = loop;
cout << i<<" ";
cout << j;
Sleep(500);}}
}}
void level1()
{
while (!_kbhit()){
for (loop = 0; loop <5; loop++)
{
if (!_kbhit()){
clrscr();
cout << "________\n";
for (side = 1; side <=12; side++)
{cout << "| |\n";}
cout << dots[loop]<<endl;
cout << "---------";
i = loop;
cout << i;
Sleep(500);}}
for (loop =3; loop >= 1; loop--)
{
if (!_kbhit()){
clrscr();
cout << "________\n";
for (side = 1; side <=12; side++)
{cout << "| |\n";}
cout << dots[loop]<<endl;
cout << "---------";
i = loop;
cout << i;
Sleep(500);}}
}}
int main()
{
level1();
_getch();
level2();
_getch();
checklvl2();
system("pause");
return 0;
}
|