怎么運行錯誤
#include <stdio.h>
int main()?
{
? ? int sale=120; //銷售業績為120萬
? ? int year=1; //剛剛進入公司1年
? ? if(sale > 100)
? ? {
? ? ? ? if(year >= 2)
? ? ? ? {
? ? ? ? ? ? printf("%s\n","優秀員工獎");
? ? ? ? }
? ??
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? printf("%s\n","很遺憾,期望你再接再厲");
? ? ? ? }
? ??
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? printf("%s\n","很遺憾,期望你再接再厲");
? ? ? ? }
? ? }
? ? ? ? return 0;
}
2021-09-03
#include <stdio.h>
int main()?
{
? ? int sale=90; //銷售業績為120萬
? ? int year=1; //剛剛進入公司1年
? ? if(sale > 100)
? ? {
? ? ? if(year >= 2)
? ? ? ? {
? ? ? ? ? ? printf("%s\n","優秀員工獎");
? ? ? ? }
? ? ? ?else
? ? ? ? {
? ? ? ? ? ? printf("%s\n","很遺憾,期望你再接再厲");
? ? ? ? }
? ? ? ??
? ? }
? ? else
? ? ? ? {
? ? ? ? ? ? printf("%s\n","很抱歉,期望你再接再厲");
? ? ? ? }
? ? ? ? return 0;
}
2021-08-20
你第二個else應該對應第一個if,你現在就只有一個if,內置變成了一個if兩個else。
2021-08-17
#include <stdio.h>
int main()
{
? ? int sum = 0;
? ? int i;
? ? for(i=1; i<=10; i++)
? ? {
? ? ? ? printf("%d\n", i);
? ? ? ? if(i==3)//是不是少了一個判斷呢?
? ? ? ? {
? ? ? ? ? ? goto END0;
? ? ? ? }? ? ? ? ? ? ? ? ? ? //在這里使用goto語句
? ? }
? ? END0:printf("結束for循環了....");? //請選擇合適位置添加標識符
? ? return 0;? ??
}