微软雅黑, 黑体, Arial, Helvetica, sans-serif; font-size: 18px; background-color: rgb(255, 255, 255);">步骤1:启动Visual C++ 6.0
微软雅黑, 黑体, Arial, Helvetica, sans-serif; font-size: 18px; background-color: rgb(255, 255, 255);">步骤2:新建C语言源程序文件(*.c)
步骤3:在C源程序文件中,输入如下代码:
#include "iostream.h"
int main()
{
int Credit;
cout<<"请输入该会员的积分:";
cin>>Credit;
if(Credit>0&&Credit<1000)
cout<<"普通会员!"<<endl;
elseif(Credit<5000)
cout<<"银卡会员 "<<endl;
elseif(Credit<10000)
cout<<"金卡会员!"<<endl;
else cout<<"贵宾卡会员!"<<endl;
return 0;
}
或
#include "iostream.h"
int main()
{
int Credit;
cout<<"请输入该会员的积分:";
cin>>Credit;
switch(Credit/1000)
{
case 0:cout<<"普通会员! "<<endl; break;
case 1:
case 2:
case 3:
case 4:cout<<"银卡会员! "<<endl; break;
case 5:
case 6:
case 7:
case 8:
case 9:cout<<"金卡会员! "<<endl; break;
default:cout<<"贵宾卡会员!"<<endl;
}
}
步骤4:编译连接
步骤5:执行,运行结果如下所示:
请输入该会员的积分:2688↙
银卡会员