欢迎来到天天文库
浏览记录
ID:57256692
大小:54.50 KB
页数:23页
时间:2020-08-07
《实验一--数据类型和表达式.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验一数据类型和表达式选课时间:星期三下午学号姓名徐志鹏【实验目的】1、熟悉并学习使用C++程序编译平台VC6.0;2、掌握如何在编译平台下编辑、编译、连接和运行一个简单的C++程序;3、掌握C++语言基础数据类型,熟悉变量及常量的定义和赋值方法;4、学会使用C++算术运算符和算术表达式;5、掌握C++程序的赋值和输入输出语句的使用方法;6、掌握简单C++程序的编写和调试【源程序】1:#includeusingnamespacestd;intmin(inta,intb){if(a2、a;}returnb;}intmain(){inta,b;cin>>a>>b;cout<usingnamespacestd;intmain(){inta;doubleb;cin>>a>>b;if(ausingnamespacestd;intmain(){doublea,b;cin>>a;b=a*(9.00/5.00)3、+32;cout<#definefhcl1.60934usingnamespacestd;intmain(){doublea,b;cin>>a;b=a/fhcl;cout<usingnamespacestd;intmain(){inta,i,b;cin>>a;if(a>=1000){b=a%10000;a=a-b+1111;}elseif(a>=100&&a<1000){a=111;}else4、if(a>=10&&a<100){a=11;}elseif(a>=0&&a<10){a=1;}cout<#include5、h>usingnamespacestd;voidconver(double*x,double*y){doublea,b;a=(*x)*cos(*y);b=(*x)*sin(*y);cout<>x>>y;conver(&x,&y);//传值调用conver(x,y);//引用调用6、cout<usingnamespacestd;typedefstructfu{doublezb;doublexb;}fushu;voidproduct(double&a,double&b)//浮点数相乘{doublec;c=a*b;cout<7、b;cout<>x>>y;product(x,y);cout<<"两个复数"<<'';cin>>a.zb>>a.xb;cin>>b.zb>>b.xb;product(a,b);return0;}3:#include#include#definepi3.14usingnamespacestd;intcomputeday(8、intyear,intmot,intday){intnum;num=year*365+mot*30+day;returnnum;}doublecompute_physiological_index(intage){doublecp;cp=sin(((2*pi)/28)*age);returncp;}doublecompute_em
2、a;}returnb;}intmain(){inta,b;cin>>a>>b;cout<usingnamespacestd;intmain(){inta;doubleb;cin>>a>>b;if(ausingnamespacestd;intmain(){doublea,b;cin>>a;b=a*(9.00/5.00)
3、+32;cout<#definefhcl1.60934usingnamespacestd;intmain(){doublea,b;cin>>a;b=a/fhcl;cout<usingnamespacestd;intmain(){inta,i,b;cin>>a;if(a>=1000){b=a%10000;a=a-b+1111;}elseif(a>=100&&a<1000){a=111;}else
4、if(a>=10&&a<100){a=11;}elseif(a>=0&&a<10){a=1;}cout<#include5、h>usingnamespacestd;voidconver(double*x,double*y){doublea,b;a=(*x)*cos(*y);b=(*x)*sin(*y);cout<>x>>y;conver(&x,&y);//传值调用conver(x,y);//引用调用6、cout<usingnamespacestd;typedefstructfu{doublezb;doublexb;}fushu;voidproduct(double&a,double&b)//浮点数相乘{doublec;c=a*b;cout<7、b;cout<>x>>y;product(x,y);cout<<"两个复数"<<'';cin>>a.zb>>a.xb;cin>>b.zb>>b.xb;product(a,b);return0;}3:#include#include#definepi3.14usingnamespacestd;intcomputeday(8、intyear,intmot,intday){intnum;num=year*365+mot*30+day;returnnum;}doublecompute_physiological_index(intage){doublecp;cp=sin(((2*pi)/28)*age);returncp;}doublecompute_em
5、h>usingnamespacestd;voidconver(double*x,double*y){doublea,b;a=(*x)*cos(*y);b=(*x)*sin(*y);cout<>x>>y;conver(&x,&y);//传值调用conver(x,y);//引用调用
6、cout<usingnamespacestd;typedefstructfu{doublezb;doublexb;}fushu;voidproduct(double&a,double&b)//浮点数相乘{doublec;c=a*b;cout<7、b;cout<>x>>y;product(x,y);cout<<"两个复数"<<'';cin>>a.zb>>a.xb;cin>>b.zb>>b.xb;product(a,b);return0;}3:#include#include#definepi3.14usingnamespacestd;intcomputeday(8、intyear,intmot,intday){intnum;num=year*365+mot*30+day;returnnum;}doublecompute_physiological_index(intage){doublecp;cp=sin(((2*pi)/28)*age);returncp;}doublecompute_em
7、b;cout<>x>>y;product(x,y);cout<<"两个复数"<<'';cin>>a.zb>>a.xb;cin>>b.zb>>b.xb;product(a,b);return0;}3:#include#include#definepi3.14usingnamespacestd;intcomputeday(
8、intyear,intmot,intday){intnum;num=year*365+mot*30+day;returnnum;}doublecompute_physiological_index(intage){doublecp;cp=sin(((2*pi)/28)*age);returncp;}doublecompute_em
此文档下载收益归作者所有