首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看C语言
#include "../require.h"
#include <iostream>
#include <sstream>
#include <cstring>
using namespace std;

template <typename Type, int Count>
class Array
{
    enum { sz = Count };
    Type i[Count];

......................
阅读全部 | gougoudan 贴于 2020年6月8日 11:31     hide bbsi
#include "stdio.h"

typedef unsigned char   uint8;
void showBinary(const char* name, int c)
{
    char res[32] = {};
    char* p = &res[31];
    for (int i = 8; i--; c >>= 1){
        *--p = (c & 1) + '0';
    }
    printf("%s = %s", name, p);
}
......................
阅读全部 | gougoudan 贴于 2020年6月7日 22:10     hide bbsi
#include "stdio.h"

typedef unsigned char   uint8;
void showBinary(const char* name, int c)
{
    char res[32] = {};
    char* p = &res[31];
    for (int i = 8; i--; c >>= 1){
        *--p = (c & 1) + '0';
    }
    printf("%s = %s", name, p);
}
......................
阅读全部 | gougoudan 贴于 2020年6月7日 22:10     hide bbsi
#include "stdio.h"
int main()
{
    float money;
    float k1;
    int year, hour;
    scanf("%d %d", &year, &hour);
    if (year < 5)
        k1 = 30;
    else
        k1 = 50;

......................
阅读全部 | gougoudan 贴于 2020年6月7日 10:44     hide bbsi
#include <stdio.h>
float func(int n, int x)
{
    float fn;
    if (n == 0) return 1;
    if (n == 1) return x;

    fn = (float)n;
    return ((2 * fn - 1) * x * func(n - 1, x) - (fn - 1) * func(n - 2, x)) / fn;
}
int main()
{
......................
阅读全部 | gougoudan 贴于 2020年6月6日 21:15     hide bbsi
//---1.
#include "stdio.h"
int mystrlen(char *s)
{
    int n = 0; 
    while (*s++) ++n;
    return n;
}
int main()
{
    int i;
    int inCount = 0;
......................
阅读全部 | gougoudan 贴于 2020年6月6日 18:32     hide bbsi
// 1.
#include "stdio.h"
int mystrlen(char *s)
{
    int n = 0; 
    while (*s++) ++n;
    return n;
}
int main1()
{
    int i;
    int inCount = 0;
......................
阅读全部 | gougoudan 贴于 2020年6月6日 18:25     hide bbsi
// 1. 四舍五入
#include "stdio.h"
int main()
{
    float fd;
    scanf("%f", &fd);
    int id = (int)(fd + 0.5f);

    printf("%f 四舍五入 = %d", fd, id);
    return 0;
}

......................
阅读全部 | gougoudan 贴于 2020年6月6日 16:50     hide bbsi
#include "stdio.h"
int main()
{
    char ss[32], res[32] = {};
    gets(ss);

    int a = 0, b = 0;
    char* p = ss;
    for (; *p; ++p){
        if (*p == ' '){ ++p; break; }
        a = (a << 1) | (*p - '0');
    }
......................
阅读全部 | gougoudan 贴于 2020年6月6日 13:51     hide bbsi
#include "stdio.h"
int main()
{
    char ss[32], res[32] = {};
    gets(ss);

    int a = 0, b=0;
    char* p = ss;
    for (; *p; ++p){
        if (*p == ' '){ ++p; break; }
        a = (a << 1) | (*p - '0');
    }
......................
阅读全部 | gougoudan 贴于 2020年6月6日 13:31     hide bbsi
上一页 43 44 45 46 47 48 49 50 51 52 下一页