#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include <direct.h>
void getcmd(char* source,char* dest)
{
int i=0;
int j=0;
while(source[i]!=' ')
{
......................
阅读全部 | 2014年2月23日 19:16
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
system("cls");
char cmd[128]={'\0'};
char th;
int ptr=0;
while(1)
......................
阅读全部 | 2014年2月22日 21:10
#include <stdio.h>
#define zero 0.000001
double mypow(double x,int n)
{
if(n==0) return 1.0;
double t=1.0;
for(;n>0;t*=x,n--);
return t;
}
int searchroot(double x,int n)
......................
阅读全部 | 2014年2月2日 22:16
#include <stdio.h>
int main()
{
char *s[512];
scanf("%s", s);
*(stdin->_ptr) = '\0';
printf("------神奇的分割线开始------\n");
int len= (int)(stdin->_ptr-stdin->_base);
printf("正序输出为:%s\n", stdin->_base);
printf("倒序输出为:");
while(len>0)
......................
阅读全部 | 2014年1月20日 14:42
#include "stdio.h"
main()
{
// 下面是两种题目
unsigned x = 91; // 01011011 二进制
int p=5,n=2,y=32; // result 107
printf("%d\n", x & ~(~(~0<<n) << (p+1-n))); //把x第p位开始往右n个字符清0,其余不变
printf("%d\n", y & ~(~0<<n) << (p+1-n)); //把y中除最右边的n位意外的其他位都清零,并左移到第p位处
//--------------------------------- ~为取反,二进制位的0全变为1,1全变为0----------------------------------------------
printf("%d\n", ~0<<n ); //把一个所有位都为1的屏蔽码左移n位(右边将多出n个0位)
printf("%d\n", ~(~0<<n) ); //把屏蔽码n位全设置为1,其余位0
printf("%d\n", ~(~0<<n) << (p+1-n) ); //把屏蔽码为1的位左移到p处
......................
阅读全部 | 2014年1月14日 11:03
#include <stdio.h>
int c_sec(int source)
{
int i=1;
int s=0;
while(i<=source)
{
if((source & i)>0) s++;
i*=2;
}
return s;
}
......................
阅读全部 | 2013年12月18日 10:30
#include<stdio.h>
//这是一段 能够输出1000000以内的所有回文数的程序
int main()
{
char jym[8]= {'\0'};
int cssj;
int index=0;
int ip1,ip2;
int tmp;
for(cssj=11; cssj<=1000000; cssj++)
{
......................
阅读全部 | 2013年12月6日 11:33
#include<stdio.h>
//这是一段校验身份证真伪的一段代码
int main()
{
int jqyz[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; //对应前17位的加权因子
char jym[11]={'1','0','X','9','8','7','6','5','4','3','2'}; // 11位校验码
char sfz[100]={'\0'};
int jqcj=0;
printf("请输入待校验的身份证号码:");
scanf("%s",&sfz[0]);
return 0;
......................
阅读全部 | 2013年12月6日 10:03
#include <stdio.h>
#include <string.h>
int main()
{
char tmp[100]= {'\0'};
char* t="T/TOOL_NUM/ MO6";
char* subt="/TOOL_NUM/";
char* _subt="02";
char* newt=strstr(t,subt);
if(newt==NULL)
{
......................
阅读全部 | 2013年11月13日 14:00
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
#define _CRT_SECURE_NO_WARNINGS //该死不
#include <stdio.h>
#include <malloc.h>
int main()
{
char* s[200];
......................
阅读全部 | 2013年11月6日 20:37