ok im sorry i assumed that it was the sign that made the program crash. my program did compile but after the inputs it crashed. (windows error "program needs to close")
here is the code for the hole thing...i though it was good =/
Code:
//John Torres
//COP 3223-0002
//Assignment #1.3
//September, 4, 2008
#include <stdio.h>
int main(void)
{
char State_One[21];
char State_Two[21];
char Candidate[21];
int State_One_Votes;
int State_Two_Votes;
int Both_States;
int Votes_Won;
int Votes_Needed;
//input
printf("Who is your candiate?\n(Obama or McCain for 2008)\n");
scanf("%s",Candidate);
printf("What is the name of the first state in question?\n");
scanf("%s",&State_One);
printf("What is the name of the second state?\n");
scanf("%s",&State_Two);
printf("How many votes are in %s?\n",State_One);
scanf("%d",&State_One_Votes);
printf("How many votes are in %s?\n",State_Two);
scanf("%d",&State_Two_Votes);
printf("How many votes does %s already have?\n",Candidate);
scanf("%d",Votes_Won);
//math
Votes_Needed=270-Votes_Won;
Both_States=State_One_Votes+State_Two_Votes;
//outputs
if (Votes_Needed<1)
{
printf("%s has already won! Go party!\n",Candidate);
system("pause");
return 0;
}
if (Votes_Needed<=State_One_Votes)
{
if (Votes_Needed>State_Two_Votes)
{
printf("If %s can win %s then %s will win the election\n",Candidate, State_One, Candidate);
system("pause");
return 0;
}
if (Votes_Needed<=State_Two_Votes)
{
printf("If %s can win %s or %s then %s will win the election\n",Candidate, State_One, State_Two, Candidate);
system("pause");
return 0;
}
}
if (Votes_Needed<=State_Two_Votes)
{
printf("If %s can win %s then %s will win the election\n",Candidate, State_Two, Candidate);
system("pause");
return 0;
}
if (Votes_Needed<=Both_States)
{
printf("If %s can win %s and %s then %s will win the election\n",Candidate, State_One, State_Two, Candidate);
system("pause");
return 0;
}
if (Votes_Needed>Both_States)
{
printf("%s cannot win.\n",Candidate);
system("pause");
return 0;
}
}