判断语句小练习

#include <iostream>

using namespace std;

int main(int argc , char * argv[] )
{
	//判断字符是否为数字字符
	
/*	int num = 'a' ;
	
	bool ret = num >= '1' && num <= '9';

	cout << ret <<endl;

*/

/*
	//判断字符是否为大写字母
	
	int ch = 'F';

	bool ret = ch >= 'A' && ch <= 'Z';
    cout << ret << endl;

*/
	//判断字符是否为小写字母
/*
    
	int ch = 'r' ;

	bool ret = ch >= 'a' && ch <= 'z';

	cout << ret << endl;

*/

	//判断字符是否为英文字母
	
/*	int ch = '1';

	bool ret = ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <=  'Z';

    cout << ret << endl;

*/
  // 润年判断 :可以被4证除,但是不能被100证除,或者可以被400证除。
  
/*

 int year = 4000 ;

 bool ret = year % 4 == 0 && year % 100 != 0 || year %400 ==0;

 cout << ret << endl;

*/


}

#include <iostream>

using namespace std;

int main(int argc , char * argv [])
{

/*

	 if(条件判断,要求提供数据为 bool类型 0 or 1)
	 {
       if 满足条件执行目标语句体

	 } 
	
	 
 
	int mon  = -90; 
	if (mon > 5)
	{
         cout << "成功" << endl; 
	}
      cout <<"错误"  << endl;
      return 0;

	// if else 分级
	
     int cake =  5 ;
	 int people = 0;

     
	 cout << "输入人数:" << endl;
	 
	 cin >>  people ;

	 if(cake >= people)
	 {
		 cout << "分配足够" << endl;
	 }else
	 {
		 cout << "库存不足!!!" << endl;
	 }

     return 0;


int num = 0;

cout << "检测等级:" << endl;
cin >> num ;

if(num == 100 )
{
	cout << "斗帝" << endl;
}else if(num >= 90 && num <= 99 )
{
	cout << "斗圣" << endl;

}else if (num >=80 && num <=89)
{
  cout << "斗尊" << endl;
}else if (num <= 79 && num >=1 )
{
	cout << "还需努力修炼" << endl;

}else
{
	cout << "普通人" <<endl;
}



 */

cout << "点歌" << endl;
cout << "1:周杰伦" << endl;
cout << "2:陈奕迅" << endl;
cout << "3:汪峰" << endl;
cout << "4:李健" << endl;
cout << "5:胡歌" << endl;

int choose = 0;
cin >> choose ;

switch (choose)
{
	case 1:
		cout << "请支付:11 RMB" << endl;
		break;
	
	case 2:
		cout << "请支付:6 RMB" << endl;
		break;
		
	case 3:
		cout << "请支付:7 RMB" << endl;
		break;
	case 4:
		cout << "请支付:14 RMB" << endl;
		break;
	case 5:
		cout << "请支付:19 RMB" << endl;
		break;

	default:

		cout << "不在曲库中" << endl;
 
      break;
	
}

}








  • 7
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值