c++


char x[10]="beijing";
char c[3][10];
for(int i=0;i<3;i++)
{
cin>>c[i];
}
if(strcmp(x,c[1])==0)
cout<<"equal"<<endl;


====================================

char *ch;
ch=(char*)malloc(n*sizeof(char));

 

 

------------------------------
void opp(int *p)
{
*p=3;
}
void ppo(void (*opp)(int *n))
{
int n=7;
opp(&n);
cout<<n;
}
int main()
{
ppo(opp);
return 0;
}
------------------------------
void opp(int *p)
{
*p=3;
}
void ppo()//void (*opp)(int *n))
{
int n=7;
opp(&n);
cout<<n;
}
int main()
{
ppo();
return 0;
}
------------------------------
void ppo(void (*opp)(int *n))
{
int n=7;
opp(&n);
cout<<n;
}
void opp(int *p)
{
*p=3;
}
int main()
{
ppo(opp);
return 0;

===============================


#include<bits_stdc++.h>
using namespace std;
void get(char *p)
{
cout<<p<<endl;
char c[]="bei";
if(!strcmp(p,c))
cout<<"yes";
else
cout<<"no";
}
int main ()
{
char c[10];
cin>>c;
get(c);
return 0;
}


------------------------------
#include<bits_stdc++.h>
using namespace std;

int main ()
{
int i;
int a[6];
for(i=0;i<6;i++)
{
a[i]=(rand()%100);//(rand()%(b-a))+a //a~b区间
cout<<a[i]<<endl;
}
return 0;
}

 ==========================================

 

#include<iostream>
using namespace std;
int main()
{
char c[2][10];
char ci[8]="abcsd";
int i=0,j=0;
while((c[1][i++]=ci[j++])!='\0');
cout<<c[1];//cout can putout chars!
return 0;
}

 

 

 

 

 

 

 

 

}

posted @ 2018-02-12 09:13  夜游星  阅读(193)  评论(0编辑  收藏  举报