xcxd.net
当前位置:首页 >> 急求一道C++编程题!!! >>

急求一道C++编程题!!!

float fun(float a[],int n,float &max,float *min){ float sum = max = *min = a[0]; for(int i=1; i<n; i++) { if(a[i]>max) max = a[i]; if(a[i]<*min) *min = a[i]; sum += a[i]; } return sum/n;}

#include<iostream> using namespace std; class Point { private: double x; double y; public: Point():x(0),y(0){} Point(double a,double b):x(a),y(b){} ~Point(){} Point& operator++(){x++;y++;return *this;} friend Point &operator--(Point &p){p.x--;p.y--;return p

/* 9 10 11 19 20 23 31 34 35 39 42 43 45 49 54 62 65 87 88 89Press any key to continue */ #include <stdio.h> void Sort(int a[],int n) { int i,j,k,t; for(i = 0; i < n - 1; ++i) { k = i; for(j = i + 1; j < n; ++j) if(a[k] > a[j]) k = j; if(k != i) { t = a[i]; a[i] = a[k]; a[k] = t; } }}

这个没意思 我当熟悉下多个模板的~ #include<iostream>using namespace std;template <typename T,typename T1>void fun(const T *a,const short &asize,const T &avalue,const T1 *b,const short &bsize,const T1 &bvalue){ T sum1=0; short p1=-1,p

delete

更新了上一个例子,希望能帮助你,如果有问题,可以继续追问我.// CppTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream> #include <string.h>using namespace std; class CTime{private: int

所谓水仙花数是指一个3位数,其各位数字立方和等于该数本身.例如,153是水仙花数,因为 153等于1的立方+5的立方+3的立方

第一个程序 #include using namespace std; int main () { float a, b, sum; cout > a; cout > b; cout > sum; if (sum == (a+b)) cout using namespace std; int main () { float a, b, sum; bool flag = false; cout > a; cout > b; while (!flag) { cout > sum; if (sum == (a

#include<stdio.h>//因为cin和scanf都会遇到空格断句,所以最好使用stdio.h下的gets()函数#include<stdlib.h>//为了最后的system("pause");防止程序一闪而过#include<iostream>using namespace std;int main(){ char a[100] = {0}; gets(a); int i

To be or not to be,that is the question. 莎士比亚的一句话.呵呵.每换一行i就加1.每打一个空格就取一个单词.这个单词的值就是当前的i的值.

gtbt.net | nczl.net | bnds.net | zmqs.net | xcxd.net | 网站首页 | 网站地图
All rights reserved Powered by www.xcxd.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com