#include <stdio.h>
int main(void)
{
int tmp;
printf("今天的天气是多少度?\n");
scanf("%d",&tmp);
if(tmp>16 ){
printf("出行!\n");
}
return 0;
}
int main(void)
{
int tmp;
printf("今天的天气是多少度?\n");
scanf("%d",&tmp);
if(tmp>16 ){
printf("出行!\n");
}
return 0;
}
#include <stdio.h>
#include <string.h>
#include <string.h>
//练习:需购买一物品,价格1000元,有一下几个条件
//1、有体验卡可免费使用,0元;
//2、5折的折扣卷,500元;
//3、会员卡可优惠9折;900元;
int main(void)
{
char answer[8]; //编写时需注意数组形式,否则会出问题
printf("请问你有体验卡吗?[Yes|No]\n");
scanf("%s",&answer);
if (strcmp(answer,"yes") == 0){
printf("这个物品你可以免费带回体验!\n");
//printf加括号
//scanf("%s",answer)
}else if (printf("请问你有打5折的折扣卷吗?[yes|no]\n") && scanf("%s",answer) &&
strcmp(answer,"yes") == 0){
printf("这个物品打折后价格为500元。\n");
}else if (printf("请问你有会员卡吗?可以打九折 [yes|no]\n") && scanf("%s",answer) &&
strcmp(answer,"yes")== 0){
printf("会员卡优惠后的价格为900元。\n");
}
return 0;
}
//1、有体验卡可免费使用,0元;
//2、5折的折扣卷,500元;
//3、会员卡可优惠9折;900元;
int main(void)
{
char answer[8]; //编写时需注意数组形式,否则会出问题
printf("请问你有体验卡吗?[Yes|No]\n");
scanf("%s",&answer);
if (strcmp(answer,"yes") == 0){
printf("这个物品你可以免费带回体验!\n");
//printf加括号
//scanf("%s",answer)
}else if (printf("请问你有打5折的折扣卷吗?[yes|no]\n") && scanf("%s",answer) &&
strcmp(answer,"yes") == 0){
printf("这个物品打折后价格为500元。\n");
}else if (printf("请问你有会员卡吗?可以打九折 [yes|no]\n") && scanf("%s",answer) &&
strcmp(answer,"yes")== 0){
printf("会员卡优惠后的价格为900元。\n");
}
return 0;
}