|
Newbie
Join Date: Jan 2005
Posts: 7
Rep Power: 0 
|
Whats wrong...
Ok I've made a program...it sucks but it works for what I want it to. Except for one thing. At the very end I have two If statements. If something ='s 1 then it tells you something and if something ='s 2 it tells you something. But for some reason if I type in 1 or 2 both of the statements appear. Any help would be appreciated. Here's the code:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main(void)
{
char name[10];
char name1[10];
char name2[10];
char name3[10];
char name4[10];
char name5[10];
char name6[10];
char name7[10];
char name8[10];
char name9[10];
char name10[10];
char name11[10];
char name12[10];
char name13[10];
char name14[10];
char name15[10];
char name16[10];
char name17[10];
char name18[10];
char ready[10];
int mark;
printf("\tSTEWART FAMILY GIFT EXCHANGE\n\n");
//Gets all the people's names
printf("Enter the 1st name.\n");
scanf("%s", name);
printf("Oh ok the 1st name is %s\n", name);
printf("\n\nPlease enter the 2nd name.\n");
scanf("%s", name1);
printf("Oh ok the 2nd name is %s\n", name1);
printf("\n\nPlease enter the 3rd name.\n");
scanf("%s", name2);
printf("Oh ok the 3rd name is %s\n", name2);
printf("\n\nPlease enter the 4th name.\n");
scanf("%s", name3);
printf("Oh ok the 4th name is %s\n", name3);
printf("\n\nPlease enter the 5th name.\n");
scanf("%s", name4);
printf("Oh ok the 5th name is %s\n", name4);
printf("\n\nPlease enter the 6th name.\n");
scanf("%s", name5);
printf("Oh ok the 6th name is %s\n", name5);
printf("\n\nPlease enter the 7th name.\n");
scanf("%s", name6);
printf("Oh ok the 7th name is %s\n", name6);
printf("\n\nPlease enter the 8th name.\n");
scanf("%s", name7);
printf("Oh ok the 8th name is %s\n", name7);
printf("\n\nPlease enter the 9th name.\n");
scanf("%s", name8);
printf("Oh ok the 9th name is %s\n", name8);
printf("\n\nPlease enter the 10th name.\n");
scanf("%s", name9);
printf("Oh ok the 10th name is %s\n", name9);
printf("\n\nPlease enter the 11th name.\n");
scanf("%s", name10);
printf("Oh ok the 11th name is %s\n", name10);
printf("\n\nPlease enter the 12th name.\n");
scanf("%s", name11);
printf("Oh ok the 12th name is %s\n", name11);
printf("\n\nPlease enter the 13th name.\n");
scanf("%s", name12);
printf("Oh ok the 13th name is %s\n", name12);
printf("\n\nPlease enter the 14th name.\n");
scanf("%s", name13);
printf("Oh ok the 14th name is %s\n", name13);
printf("\n\nPlease enter the 15th name.\n");
scanf("%s", name14);
printf("Oh ok the 15th name is %s\n", name14);
printf("\n\nPlease enter the 16th name.\n");
scanf("%s", name15);
printf("Oh ok the 16th name is %s\n", name15);
printf("\n\nPlease enter the 17th name.\n");
scanf("%s", name16);
printf("Oh ok the 17th name is %s\n", name16);
printf("\n\nPlease enter the 18th name.\n");
scanf("%s", name17);
printf("Oh ok the 18th name is %s\n", name17);
printf("\n\nOk the names will now be ");
printf("distributed out");
printf("\n\nType ok when ready\n");
scanf("%s", ready);
printf("\n%s gives to %s", name7, name3);
printf("\n%s gives to %s", name1, name9);
printf("\n%s gives to %s", name11, name5);
printf("\n%s gives to %s", name4, name15);
printf("\n%s gives to %s", name2, name17);
printf("\n%s gives to %s", name14, name12);
printf("\n%s gives to %s", name6, name13);
printf("\n%s gives to %s", name10, name);
printf("\n%s gives to %s", name16, name8);
printf("\n%s gives to %s", name8, name14);
printf("\n%s gives to %s", name15, name2);
printf("\n%s gives to %s", name, name6);
printf("\n%s gives to %s", name9, name11);
printf("\n%s gives to %s", name12, name16);
printf("\n%s gives to %s", name3, name10);
printf("\n%s gives to %s", name13, name7);
printf("\n%s gives to %s", name5, name1);
printf("\n%s gives to %s", name17, name4);
//integers are %d, characters are %s
printf("\n\nPlease say what number you were, or ");
printf(" press 0 to quit. ");
scanf("%d",&mark);
if(mark <1);
{
printf("\n%s gives to %s", name, name6);
}
if(mark == 2);
{
printf("\nIt Finally works!");
}
return 0;
}
|