1、C+程序编程实例大全#includeint main()std:coutname;coutname;coutage;coutn;student wang;wang.no=n;cinwang.math;coutn;if(p=new intn)=0)coutn;if(p=new intn)=0)coutusing namespace std;float a=2.4;void main()int a=8;coutvoid main()int num=50;int ref+=10;coutvoid main()int num;int num=5;coutusing namespace std;void
2、 swap(int void main()int x=5,y=6; cout/using namespace std;void main()/*double radius;coutradius;double result=radius*radius*3.14*4;coutradius;std:coutusing namespace std;int array64=60,80,90,75,75,85,65,77,80,88,90,98,89,100,78,81,62,68,69,75,85,85,77,91;int void main()int typeA=0,typeB=0;int stude
3、nt=6;int gradesize=4;for(int i=0;i=80)return tA;elsereturn tB;/* Note:Your choice is C IDE */#include using namespace std;float t=3.14*r*r;return t;void main()fn2(5.0)=12.4;cout#include using namespace std;void main()string s,t; couts;t=“I like programming!“; coutusing namespace std;inline double ci
4、rcumference(double radius);void main()double r=3.0,s;s=circumference(r);coutint add(int x,int y)int sum;sum=x+y;return sum;int add(int x,int y,int z)int sum;sum=x+y+z;return sum;void main()int a,b;a=add(5,10);b=add(5,10,20);couttemplateT min(T a,int n)int i;T minv=a0;for(i=1;iai)minv=ai;return minv;
5、void main()int a=1,3,0,2,7,6,4,5,2;double b=1.2,-3.4,6.8,9.8;int c=1,9,5,-6,7,8;cout#define PI 3.1415926535#define CS Circle_Squaretemplatedouble Circle_Square(T x)return x*x*PI;double Circle_Square(long x)return x*x*PI;void main()int r1=1;double r2=2.0;long r3=3;coutvoid main()int i=0,i=+l-k;coutcl
6、ass Tdatepublic:void set(int,int,int);int isLeapYear();void print();private:int month;int day;int year;void Tdate:set(int m,int d,int y)month=m;day=d;year=y;int Tdate:isLeapYear()return(year%4=0void Tdate:print()coutclass Tdatepublic:void set(int,int,int);int isLeapYear();void print();private:int mo
7、nth;int day;int year;void Tdate:set(int m,int d,int y)month=m;day=d;year=y;int Tdate:isLeapYear()return(year%4=0void Tdate:print()coutprint();if(*pTdate).isLeapYear()coutusing namespace std;void sphere();int main()sphere();void sphere()double radius;coutradius;if(radiusconst int SIZE=10;class Cstackprivate:char stkSIZE;int position;public:void init()position=0;char push(char ch);char pop();char Cstack:push(char ch)if(position=SIZE)cout“栈满“endl;return 0;stkposition+=ch;return ch;char Cstack:pop()