Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:木棒程序的编程c++

Posted by yuan5531750 at 2011-08-23 18:26:30 on Problem 1011
In Reply To:木棒程序的编程c++ Posted by:miji90000 at 2011-01-23 23:22:37
> 我是这样写的,我认为就是找最大、最小值的问题,这段代码在vc上没有问题,但是到系统来就说编译错误,新手求解。。。- =
> #include<iostream.h>
> void main()
> {
> 	int n,a[64],max,min;
> 	cin>>n;
> 	for(int i(0);i<n;i++)
> 	{cin>>a[i];}
> 	max=a[0];min=a[n-1];
> 	for(i=0;i<n;i++)
> 	{
> 		if(a[i]>max)
> 			max=a[i];
> 	}
> 	for(i=0;i<n;i++)
> 	{
> 		if(a[i]<min)
> 			min=a[i];
> 	}
> 	cout<<max+min;
> }


少了using namespace std;
思路完全错了……………………

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator