`

VC6最基本

 
阅读更多

高级语言C++程序设计【chap4】【p119-1】【我的自考书-刘璟周玉龙书】

1.VC6使用:

<1>.编译:"Build"-->"Compile"=======>  Ctrl+F7;

<2>.连接:"Build"-->"Build"     =======>  F7;

<3>.运行:"Build"-->"Execute"=======>  Ctrl+F5;

2.【page119页 练习题1:】

/* 1.输入3个实数,打印最大最小值到终端 */
#include <iostream>
using namespace std;
int main(){
	double d1,d2,d3;
	cout<<"输入三个实数:"<<endl;
	cin>>d1>>d2>>d3;
	if(d1>=d2){
		if(d1>=d3){
			cout<<"最大数是:"<<d1<<endl;
			if(d2>d3){
				cout<<"最小数:"<<d3<<endl;
			}else{
				cout<<"最小数:"<<d2<<endl;
			}
		}else{
			cout<<"最大数是:"<<d3<<endl;
			if(d1>d2){
				cout<<"最小数:"<<d2<<endl;
			}else{
				cout<<"最小数:"<<d1<<endl;
			}
		}
	}else{
		if(d2>=d3){
			cout<<"最大数是:"<<d2<<endl;
			if(d1>d3){
				cout<<"最小数:"<<d3<<endl;
			}else{
				cout<<"最小数:"<<d1<<endl;
			}
		}else{
			cout<<"最大数是:"<<d3<<endl;
			if(d1>d2){
				cout<<"最小数:"<<d2<<endl;
			}else{
				cout<<"最小数:"<<d1<<endl;
			}
		}
	}
}

 

 

0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics