原创 1.8

#include "iostream" using namespace std; void sort(int a,int b) { int temp; if(a<b) {temp=a;a=b;b=temp;} } i

原创 1.9

#include <iostream>using namespace std; int main() { void sort(int &,int &,int &); int a,b,c; cout<<"請輸入三個正整數"; cin

原创 1.7

#include<iostream> using namespace std; int max(int a,int b,int c=0) { return a>b ? (a>c ? a:c):(b>c ? b:c); } int m

原创 1.11

#include<iostream> #include<string> using namespace std; int main() {string str;cin>>str;int i,j;int length=sizeof(str)

原创 第三章

3. #include <iostream> using namespace std; class Date { public: Date(int=1,int=1,int=2005); void display(); private: i

原创 1.14

#include<iostream>using namespace std;template<typename Q>Q sort(Q a[],Q n,Q temb){    int i,j;    for(i=0;i<n-1;i++) 

原创 2.4

#include<string> using namespace std; class student {public:void display();int num;string name;char sex; }; #include<io

原创 3.7

7.(1) #include <iostream> using namespace std; class Student { public: Student(int n,float s):num(n),score(s){} void ch

原创 3.9

9. #include <iostream> using namespace std; class Product { public: Product(int n,int q,float p):num(n),quantity(q),pri

原创 3.5

5.  #include <iostream> using namespace std; class Student { public: Student(int n,int s):num(n),score(s){} int num; in

原创 3.10

9. #include <iostream> using namespace std; class Product { public: Product(int n,int q,float p):num(n),quantity(q),pri

原创 1.12

#include<iostream> #include<string> using namespace std; void bubble_sort(string a[],int n) {int i,j;string temb;for(i=

原创 3.12

12. #include <iostream> using namespace std; template<class numtype> class Compare {  public:  Compare(numtype a,numtyp

原创 3.4

4.  #include <iostream> using namespace std; class Student { public: Student(int n,int s):num(n),score(s){} void displa

原创 1.13

#include<iostream> using namespace std; template<typename Q> Q paixu(Q*a,int n) { fo