Max Value-Unit test

Source: Internet
Author: User

1#include <iostream>2 using namespacestd;3 intLargest (intList[],intlength);//list[]: function to find the maximum value,4 intMain ()5 {6     intlist[ -];//an array of length 1007     intlenght;8     inti; 9cout <<"Please enter the length of the one-dimensional array:";TenCin >> Lenght;//Input Array Length One     if(Lenght = =0)//consider that the length of the array cannot be 0 A     { -Cerr <<"the array length cannot be zero!! "<<Endl; -         return 0;  the     } -cout <<"Please enter"<< Lenght <<"an integer:";  -      for(i =0; I < lenght; i++)                -     { +CIN >> List[i];//Enter array values and calculate the maximum number of groups -     } +cout <<"The maximum value for this array is:"<< largest (list, lenght) << Endl;//largest (List,lenght): Indicates the maximum value A     return 0; at } - intLargest (intList[],intLength//to find the maximum value of this array - { -     intI, max = list[0]; -      for(i =1; i < length; i++) -     { in         if(List[i] >max) -         { toMax =List[i]; +         } -     } the     returnMax; *}

Design ideas: Array size cannot be 0, directly input array data, to find the maximum value
Experiment:

Design schedule:

Event Time period Time Date
Design ideas 10:00-10:45 45m April 9
Find information 7:00-7:30 30m April 10
Ask your classmates 7:30-8:30 1h
Translation Program 8:30-900 30m
Summarize 9:00-9:30 30m

Summary: Understand part of the content, if done more, will naturally extrapolate, sure enough, pay will have harvest.

Max Value-Unit test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.