visual c++ 运行c程序出现未声明的标识符,求解答
#include<stdio.h>intmain(void){intage=0;intcollege=0;intsubject=0;boolinterview=false...
#include <stdio.h>
int main(void){ int age = 0; int college = 0; int subject = 0; bool interview = false;
printf("\nWhat college? 1 for Harvard, 2 for Yale, 3 for others: "); scanf("%d", &college); printf("\nWhat subject? 1 for Chemistry, 2 for economics, 3 for others: "); scanf("%d", &subject); printf("\nHow old is the applicant?"); scanf("%d", age);
/* Check out the applicant */ if ((age > 25 && subject == 1) && (college == 3 || college == 1)) interview = true; if (college == 2 && subject == 1) interview = true; if (college == 1 && subject == 2 && !(age > 28)) interview = true; if (college == 2 && (subject == 2 || subject == 3) && age > 25) interview = true;
/* Output decision for interview */ if (interview) printf("\n\nGive 'em an interview."); else printf("\n\nReject 'em."); return 0;} 展开
int main(void){ int age = 0; int college = 0; int subject = 0; bool interview = false;
printf("\nWhat college? 1 for Harvard, 2 for Yale, 3 for others: "); scanf("%d", &college); printf("\nWhat subject? 1 for Chemistry, 2 for economics, 3 for others: "); scanf("%d", &subject); printf("\nHow old is the applicant?"); scanf("%d", age);
/* Check out the applicant */ if ((age > 25 && subject == 1) && (college == 3 || college == 1)) interview = true; if (college == 2 && subject == 1) interview = true; if (college == 1 && subject == 2 && !(age > 28)) interview = true; if (college == 2 && (subject == 2 || subject == 3) && age > 25) interview = true;
/* Output decision for interview */ if (interview) printf("\n\nGive 'em an interview."); else printf("\n\nReject 'em."); return 0;} 展开
2个回答
2013-12-19
展开全部
开头加#include <stdbool.h>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询