#include<stdio.h>
#include<string.h>
int main(int argc, const char *argv[])
{
int data=0;
int a,b;
printf("请输入数据data\n");
scanf("%d",&data);
a=data|1<<5;
b=a&~(1<<3);
printf("%d\n",b);
return 0;
}
aacba
dabdd
dabcd
dcabb
aacbc
#include <stdio.h>
#include <string.h>
int main(int argc, const char *argv[])
{
int arr[10]={1,3,5,7,9,11,13,15,17,19};
int brr[10]={2,4,6,8,10,12,14,16,18,20};
int crr[20]={0};
int len1 =0;
int len2 = 0;
int i,j;
int temp=0;
for(i=0;arr[i] !='\0';i++)
{
len1++;
}
for(i=0;brr[i] !='\0';i++)
{
len2++;
}
for(i=0;i<len2;i++)
{
arr[len1+i] = brr[i];
}
for(i=0;i<(len1+len2-1);i++)
{
crr[i]=arr[i];
printf("%d\n",crr[i]);
}
for(i = 1;i<=19;i++)
{
for(j=0;j<20-i;j++)
{
if(crr[j]>crr[j+1])
{
temp = crr[j];
crr[j] = crr[j+1];
crr[j+1] = temp;
}
}
}
for(i=0;i<20;i++)
{
printf("%d\t",crr[i]);
}
printf("\n");
return 0;
}
#include <stdio.h>
#include <string.h>
char *mystrcat(char *str1,char *str2);
int main(int argc, const char *argv[])
{
char arr[30] = "";
char brr[30] = "";
gets(arr);
gets(brr);
printf("%s\n",mystrcat(arr,brr));
return 0;
}
char *mystrcat(char *str1,char *str2)
{
char *pa=str1;
char *pb=str2;
while(*pa !=0)
{
pa++;
}
for(;*pb !=0;pa++,pb++)
{
*pa = *pb;
}
return str1;
}
#include<stdio.h>
#include<string.h>
int main(int argc, const char *argv[])
{
int a=1,b=0;
int c;
printf("1是诚实国的路,0是说谎国的路\n");
printf("询问他们的国家路是哪一条\n");
if(a==1)
{
printf("1是我国家的路\n");
}
else
{
printf("0是我国家的路\n");
}
if(b!=1)
{
printf("1是我国家的路\n");
}
else
{
printf("0是我国家的路\n");
}
return 0;
}
#include <stdio.h>
#include <string.h>
void swap(char *start, char *end)
{
for(; start<end; start++, end--)
{
*start = *start^*end;
*end = *start^*end;
*start = *start^*end;
}
}
int main(int argc, const char *argv[])
{
char crr[15] = "I love china";
char *start = crr;
char *end = start;
while(*(end++) != 0);
end--;
swap(start, end-1);
start = crr;
end = crr;
for(; *end!=0; end++)
{
if(' ' == (*end))
{
swap(start, end-1);
start = end+1;
}
}
puts(crr);
return 0;
}
#include <stdio.h>
#include <string.h>
#define N 10
int main(int argc, const char *argv[])
{
int i;
int arr[N] = {0};
for(i=0;i<N;i++)
{
scanf("%d",&arr[i]);
}
int j,index,temp;
for(i=0;i<N;i++)
{
index = i;//0
for(j =i+1;j<N;j++)
{
if(arr[j] > arr[index])
{
index = j;
}
}
temp = arr[i];
arr[i] = arr[index];
arr[index] = temp;
}
for(i=0;i<N;i++)
{
printf("%d\t",arr[i]);
}
printf("\n");
return 0;
}