I don't think if has a capital "I". I dislike c++, so that is all the help I can offer.
and do
instead of
As the wise programmer once said: "Use single quotes for single characters."
declare all your variables at the beginning of the function
don't do
halfway through the function.
My corrected code HAS NOT BEEN TESTED
Code:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int operationtype;
char war;
float gpt;
float rl;
char unit[20];
printf("What type of operation are you performing?\n");
printf("Rob Vaults=1 Rob Towers=2 Rob Granaries=3 Kidnap Peasants=4, Steal Horses=5\n>");
scanf("%d",&operationtype);
if (operationtype == 1)
{
printf("Are you at war with your target?\n>");
scanf("%c",&war);
if (war == 'y')
{
gpt = 80.0; // gains per thief at war
rl = 0.1; // resources lost
//set units to gc
strcpy(unit,"gc");
}
else if(war == 'N')
{
gpt = 52.0; //gains per thief not at war
rl = 0.1; //resources lost not at war
strcpy(unit,"gc");
}
}
return 0;
}
Could work, you never know.