C++l课程设计25题Word文件下载.docx
《C++l课程设计25题Word文件下载.docx》由会员分享,可在线阅读,更多相关《C++l课程设计25题Word文件下载.docx(34页珍藏版)》请在冰豆网上搜索。
doublex1;
cin>
>
num>
x1;
ppitems(num,x1);
items.process();
items.show();
题2
classsp{
intn,k;
sp(intn1,intk1){n=n1;
k=k1;
intpower(intm,intn){ints=1;
for(inti=0;
n;
i++)s=m*s;
returns;
intfun(){intsum=0;
for(inti=1;
i++)sum+=power(i,k);
returnsum;
fun()<
};
{
cin>
n>
k;
sps(n,k);
s.fun();
s.show();
题3
classMOVE{
floatarray[20];
intn;
MOVE(floatb[],intm){n=m;
m;
array[i]=b[i];
voidavarge(){floats=0;
for(inti=0;
s+=array[i];
s=s/n;
s<
floatt[20];
staticintcount=0;
for(intj=0;
j<
j++)
if(array[j]<
s){
t[count]=array[j];
count++;
for(i=0;
if(array[i]>
t[count]=array[i];
for(intk=0;
k<
k++)
array[k]=t[k];
}
voidprint(){for(inti=0;
array[i]<
{floata[9]={1.3,6.2,3,9.1,4.8,7.4,5.6,9.2,2.3};
MOVEp(a,9);
p.avarge();
p.print();
题4
int*array;
MOVE(intb[],intm){n=m;
array=newint[n];
array[i]=b[i];
voidexchange(){
ints1,s2,s3,s4,t;
s1=array[0];
s2=array[0];
ints=0;
if(array[i]>
s1){s1=array[i];
s3=i;
if(array[i]<
s2){s2=array[i];
s4=i;
t=array[s3];
array[s3]=array[s4];
array[s4]=t;
for(intk=0;
s=s+array[k];
voidprint(){for(intj=0;
array[j]<
"
"
~MOVE(){if(array)delete[]array;
{inta[10]={21,65,43,87,12,84,44,97,32,55};
MOVEm(a,10);
m.exchange();
m.print();
题5
string.h>
classstring{
char*str;
inty;
string(char*s){
if(s)
str=(char*)newchar[strlen(s)+1];
strcpy(str,s);
elsestr=0;
y=0;
voidhuiwen(){
inta;
a=strlen(str);
(a/2);
{if(str[i]==str[a-1])
{a--;
y++;
continue;
else
{break;
if(y==(a/2))y=1;
elsey=0;
voidshow(){
for(intj=0;
strlen(str);
cout<
str[j]<
endl<
y;
{chars[]="
ababcedbaba"
stringtest(s);
test.huiwen();
test.show();
题6
classPHALANX
int(*p)[20];
intstartnum;
PHALANX(ints,intm)
startnum=s;
n=m;
p=newint[n][20];
voidprocess()
for(intj=0;
=i;
{
p[j][i]=i*i+j+startnum;
p[i][j]=(i+1)*(i+1)+startnum-1-j;
}
voidprint()
{
p[i][j]<
if((j+1)%4==0)cout<
~PHALANX()
{if(p)delete[]p;
inta,b;
a>
b;
PHALANXs(a,b);
s.process();
s.print();
题7
classSTRING{
charstr1[80];
charstr2[40];
STRING(char*s1,char*s2)
strcpy(str1,s1);
strcpy(str2,s2);
intj=0;
inti=0;
chart[100];
strcpy(t,str1);
while(str1[i])
str1[j++]=str2[i];
str1[j++]=t[i];
i++;
}
voidprint()
intk=0;
while(str1[k])
str1[k++]<
chara[10]="
ABCDE"
charb[10]="
abcde"
STRINGtest(a,b);
test.process();
test.print();
题8
classString{
charstr1[60];
charstr3[100];
String(char*s1,char*s2){strcpy(str1,s1);
strcpy(str2,s2);
{strcpy(str3,str1);
inti=0,j=0;
while(str1[i])
str3[j++]=str1[i];
str3[j++]=str2[i];
i++;
while(str2[i]=='
\0'
){str3[j++]=str1[i++];
voidprint()
{intm;
m=(strlen(str1)+strlen(str2));
str3[j]<
voidmain()
{chars1[8]="
ABCDEFG"
chars2[6]="
Stringtest(s1,s2);
题9
classmove{
intarray[20];
move(intb[],intm){n=m;
voidchange()
{inta,b,c;
a=array[n-3];
b=array[n-2];
c=array[n-1];
for(intj=n;
j>
2;
j--)
array[j-1]=array[j-4];
array[2]=c;
array[1]=b;
array[0]=a;
{for(intk=0;
array[k]<
intb=10;
movep(a,b);
p.change();
题10
char*array;
move(charb[],intm){n=m;
if(b)
{array=(char*)newchar[strlen(b)+1];
strcpy(array,b);
{chara[100];
intx=0,y=n-1;
k++){
if(array[k]>
=97)
{a[y]=array[k];
y--;
else{
a[x]=array[k];
x++;
}
array[i]=a[i];
voidprint(){
~move(){if(array)
deletearray;
chars[18]="
fdsUFfsTjsfKFEkWC"
movet(s,17);
t.change();
t.print();
题11
classCarray
int*a;
intb;
Carray(inta[],intn,intx)
this->
n=n;
a=newint[n];
this->
a[i]=a[i];
b=x;
voidTransform()
{for(inti=0;
a[i]=b*a[i]+i;
voidshow()
a[i]<
~Carray()
if(a)deletea;
intarr[]={1,2,3,4,5,6,7,8,9,10};
Carraytest(arr,10,2);
test.Transform();
test.show();
题12
classsin{
intx;
sin(intx,intn){this->
x=x;
this->
doublepower(intq){
doublec;
if(q==0||q==1)returnc=1.0;
else
c=q*power(q-1);
returnc;
doublemi(intx,intg)
{doublea=1;
g;
a*=x;
returna;
doublefun()
{doubles1=0,s2=0;
intk=-1;
for(intj=1;
k=k*(-1);
s1=(k*mi(x,(2*j-1))/power((2*j-1)));
s2+=s1;
returns2;
{inta,b;
sins(a,b);
s.fun();
s.show();
题13
classVAR
doublea[100];
VAR(doublex[],intn1)
n=n1;
a[i]=x[i];
doubleaverage(doublex[],intn)
doubles=0;
s+=x[i];
s=s/n;
returns;
voidvariance(doublex[],intn)
doubled=0;
d+=(a[i]-average(a,n))*(a[i]-average(a,n))/n;
d<
variance(a,n);
doubleb[20]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
VARs(b,20);
题14
题15
classArray{
inta[4][4];
Array(inta1[][4],intn){
4;
a[i][j]=a1[i][j];
voidxuanzhuan(){
intb[4][4];
for(intt=3;
t>
=0;
t--)
b[k][3-t]=a[t][k];
for(inti=0;
for(intj=0;
a[i][j]=b[i][j];
}
voidshow(){
{cout<
a[i][j]<
if((j+1)%4==0)cout<
{intc[][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
Arraytest(c,16);
test.xuanzhuan();
题16
for(intt=0;
t<
t++)
b[k][t]=a[t][3-k];
题17
stdlib.h>
classNUM{
intdata[25];
intnum[128];
NUM(intdata[25]){
25;
data[i]=data[i];
voidprocess(){
intcount=0;
inta=0;
while(a<
=9){
{for(intj=0;
if(a==data[j])count++;
num[a]=count;
count=0;
a++;
for(intt=0;
10;
{cout<
出现个数:
num[t]<
if((t+1)%5==0)cout<
{inta[25]={1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5};
NUMt(a);
t.process();
t.print();
题18
classNUM
NUM(intdata[])
{intk;
for(intj=i+1;
26;
if(data[i]>
data[j])