/*
* Copyright (c) 2011, Yantai University School of Computer Science
* All rights reserved.
* Author: Tian Yu
* Completion Date: October 11, 2012
* Version Number: v1.0
*
* Enter a description: four positive integers
* Problem Description: Given four positive integers, the maximum value of four numbers is calculated and output
* Program output: The maximum value of a given four number
* Problem Analysis: By comparing two numbers, the large assignment is given to the small one, and then the maximum value is compared.
* Algorithm design: slightly
#include <iostream>
using namespace std;
int main ()
{
int a,b,c,d;
cout<< "Please enter the value of the A,b,c,d four number:";
cin>>a>>b>>c>>d;
{
if (a<b)
a=b;
if (c<d)
C=d;
if (a>c)
cout<< "max=" <<a<< "\ n";
else
cout<< "max=" <<c<< "\ n";
}
return 0;
Operation Result:
Experience:
Homework 2 Turn relatively slow, change and change, get oneself think of the simplest to turn, programming is not simple and clear, the best at a glance understand .... Come on....