#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char buf[512]={'\0'};
char ch;
int ptr=0;
int flag=0;
......................
阅读全部 | 2014年2月26日 16:09
#include<stdio.h>
#include<stdlib.h>
int gcd(int x,int y)
//欧几里得辗转相除法求两数的最大的公约数
{
if(x<y) return gcd(y,x);
if(x%y!=0) return gcd(y,x%y);
else return y;
}
void cal_formul(char* x,char* y,char* z)
......................
阅读全部 | 2014年2月25日 21:42
int gcd(int x,int y)
//欧几里得辗转相除法求两数的最大的公约数
{
if(x<y) return gcd(y,x);
if(x%y!=0) return gcd(y,x%y);
else return y;
}
阅读全部 | 2014年2月25日 15:24
#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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace cjt2
{
class Program
{
static void Main(string[] args)
{
......................
阅读全部 | 2014年2月21日 19:26
#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