Sign in to follow this  
Waaayoff

Is it just my noobiness, or is this code just WRONG?

Recommended Posts

Waaayoff    952
Am i mistaken? when i looked at this code i was like WTF
#include<iostream.h>
#include<conio.h>

void box(int x, int xx, int y, int yy);
void box(int x, int xx, int y, int yy)
{
int xs,ys,i,j;
xs=xx-x;
ys=yy-y;
for(i=1; i<xs; i++){gotoxy(x+i,y);cout<<"Í";
gotoxy(x+i,yy);cout<<"Í"; }
for(j=1; j<ys; j++){gotoxy(x,y+j);cout<<"º"; }
for(j=1; j<ys; j++){gotoxy(xx,y+j);cout<<"º"; }
{gotoxy(x,y);cout<<"É";
gotoxy(x,yy);cout<<"È";
gotoxy(xx,y);cout<<"»";
gotoxy(xx,yy);cout<<"¼";}
}

char ans;
char ask;
int life;
int main()
{
clrscr();
box(5,50,1,45);
box(55,78,8,30);
gotoxy(62,12);cout<<"LIFELINE";
gotoxy(57,15);cout<<"1. 50:50";

gotoxy(57,18);cout<<"2. Call a friend";
gotoxy(57,21);cout<<"3. Ask the audience";

gotoxy(13,3);cout<<"Who Wants to be a Millionaire?";
gotoxy(10,5);cout<<"The Folder contains?";
gotoxy(10,9);cout<<"a. Foods";
gotoxy(24,9);cout<<"b. Files";
gotoxy(10,11);cout<<"c. Animals";
gotoxy(24,11);cout<<"d. Clothes";
getch();
gotoxy(9,13);cout<<"Do you want to use your lifeline?";
gotoxy(13,14);cout<<" Y/N : ";
cin>>ask;
if(ask=='y')
{
gotoxy(10,15);cout<<"Choose Lifeline Number: ";
cin>>life;
if(life==1)
{
gotoxy(18,17);cout<<"[ 50:50 ]";
gotoxy(10,19);cout<<"_________";
gotoxy(24,19);cout<<"c. Animals";
gotoxy(10,21);cout<<"b. Files";
gotoxy(24,21);cout<<"_________";
getch();
}
else if(life==2)
{
gotoxy(18,17);cout<<"[ Call a friend ]";
gotoxy(10,20);cout<<"Friend: I think it is B";
getch();
gotoxy(10,23);cout<<"You: How sure are you?";
getch();
gotoxy(10,26);cout<<"Friend: I'm 95% sure about this.";
getch();
}
else if(life==3)
{
gotoxy(18,17);cout<<"[ Ask the audience ]";
gotoxy(10,23);cout<<"(a.) 23% (b.) 52% (c.) 13% (d.) 12%";
getch();
}
}
else if(ask=='n')
getch();
gotoxy(10,30);cout<<"Your answer is: ";
cin>>ans;
if(ans=='a')
{
gotoxy(14,35);cout<<"Correct!";
gotoxy(10,38);cout<<"Get ready for the next round!";
}
else
{
gotoxy(14,35);cout<<"Wrong!";
gotoxy(10,38);cout<<"Play again?";
getch();
return 0;
} }

Share this post


Link to post
Share on other sites
visitor    643
Me too.

Lack of indentation.

Use of prestandard <iostream.h> (<conio.h> isn't standard either.)


void box(int x, int xx, int y, int yy);
void box(int x, int xx, int y, int yy)
{
...
}


WTF!

Hardcoding the question(s) and responses.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this