收藏 分销(赏)

C++上机程序.doc

上传人:xrp****65 文档编号:7683155 上传时间:2025-01-12 格式:DOC 页数:2 大小:24KB 下载积分:10 金币
下载 相关 举报
C++上机程序.doc_第1页
第1页 / 共2页
C++上机程序.doc_第2页
第2页 / 共2页
本文档共2页,全文阅读请下载到手机保存,查看更方便
资源描述
// rgh.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include"iostream.h" #include<string.h> int salary(char zhicheng[],int x) { char a[10]={"jiaoshou"},b[15]={"fujiaoshou"},c[10]={"jiangshi"},d[10]={"zhujiao"}; if(strcmp(zhicheng,a)==0) return 100*x; if(strcmp(zhicheng,b)==0) return 80*x; if(strcmp(zhicheng,c)==0) return 60*x; if(strcmp(zhicheng,d)==0) return 40*x; else return 0; } void main(){ char zhi[10],name[10]; int y,sum; cout<<"输入姓名和职称:"; cin>>name>>zhi; cout<<"输入课时:"; cin>>y; sum=salary(zhi,y); cout<<"课酬为:"<<sum<<endl; } 结果: 输入姓名和职称:lining jiangshi 输入课时:98 课酬为:5880 Press any key to continue 6. P412习题8 源程序或过程: // rgh.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include"iostream.h" #include<iomanip.h> int main(int argc, char* argv[]){ char *s[4]={"*","***","*****","*******"}; for(int i=0;i<4;i++) { cout<<setw(i+4)<<s[i]<<endl;} } 结果: * *** ***** ******* Press any key to continue
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 教育专区 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服