欢迎光临!

3.1if与else

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	int i;
	while (scanf("%d", &i)!=EOF)
	{
		if (i > 0)//if的括号后面是不可以加分号的
		{
		printf("i is bigger than o\n");
		}else {//上面的条件为假时,走else
		printf("i is not bigger than 0\n");
		}
		
	}
	system("pause");
	return 0;
}
/*if(number>500)cost=0.15;
     else if(number>300)cost=0.10;
	     else if(number>100)cost=0.075;
		     else if(number>50)cost=0.005;
			     else cost=o*
				 上面只有一个语句会得到执行/
/*if(i>1)
    if(i<10)
	  printf("i>1 and i<10\n");
	  else
	  printf("no,they are not\n")
	  注意大括号*/

https://github.com/mzdbxwg/xiao/blob/main/3.1if%E4%B8%8Eelse.c

posted @   国师编程  阅读(55)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
欢迎光临!!
点击右上角即可分享
微信分享提示