首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看C语言
/**
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 */
#ifndef _INC_STRING
#define _INC_STRING

#include <crtdefs.h>

#ifdef __cplusplus
extern "C" {
......................
阅读全部 | cstdio 贴于 2018年12月16日 15:43     hide bbsi
#include<stdio.h>
int main()
{
int a;
int b;
int max;
scanf("a=%d\n,b=%d\n",&a,&b);
max=(a>b)? a:b;
printf("max=%d\n",max);
return 0;


......................
阅读全部 | 加油胡椒粉 贴于 2018年12月13日 09:35     hide bbsi
疏散规则:
(1)    将教室离散成为大小相等的网格,每个同学在单位时间内只能移动一个网格或者保持不动,并且移动方向只能时上、下、左、右(如图2);
(2)    如果某个同学选择的移动目标网格被其他同学占用,那么该同学选择等待;
(3)    如果多个同学同时竞争同一网格,随机选择其中一个同学占用该网格,其余同学保持不动;
(4)    同学不能移动到桌子占用的网格,并且只能通过出口处进行疏散;
(5)    当所有同学疏散完成后,算法结束。
阅读全部 | myf1926 贴于 2018年12月9日 18:05     hide bbsi
河内之塔
说明河内之塔(Towers of Hanoi)是法国人M.Claus(Lucas)于1883年从泰国带至法国的,河内为越战时北越的首都,即现在的胡志明市;1883年法国数学家 Edouard Lucas曾提及这个故事,据说创世纪时Benares有一座波罗教塔,是由三支钻石棒(Pag)所支撑,开始时神在第一根棒上放置64个由上至下依由小至大排列的金盘(Disc),并命令僧侣将所有的金盘从第一根石棒移至第三根石棒,且搬运过程中遵守大盘子在小盘子之下的原则,若每日仅搬一个盘子,则当盘子全数搬运完毕之时,此塔将毁损,而也就是世界末日来临之时。
解法如果柱子标为ABC,要由A搬至C,在只有一个盘子时,就将它直接搬至C,当有两个盘子,就将B当作辅助柱。如果盘数超过2个,将第三个以下的盘子遮起来,就很简单了,每次处理两个盘子,也就是:A->B、A ->C、B->C这三个步骤,而被遮住的部份,其实就是进入程式的递回处理。事实上,若有n个盘子,则移动完毕所需之次数为2^n - 1,所以当盘数为64时,则所需次数为:264- 1 = 18446744073709551615为5.05390248594782e+16年,也就是约5000世纪,如果对这数字没什幺概念,就假设每秒钟搬一个盘子好了,也要约5850亿年左右。 
#include <stdio.h>
void hanoi(int n, char A, char B, char C) {
    if(n == 1) {
        printf("Move sheet %d from %c to %c\n", n, A, C);
    }
    else {
        hanoi(n-1, A, C, B);
        printf("Move sheet %d from %c to %c\n", n, A, C);
        hanoi(n-1, B, A, C);
......................
阅读全部 | qq1835931455 贴于 2018年12月8日 23:04     hide bbsi
#include<stdio.h>
 #include<time.h>
 #include<stdlib.h>
 #include<windows.h>
 #include<conio.h>
 #include<string.h>
 #define SIZE 10
 #define N 35
 char mine[12][12]={{0}};
 int step=65;
 char second[2][4];

......................
阅读全部 | czl812 贴于 2018年11月28日 17:04     hide bbsi
#include <stdio.h>
int a,b,result,chance;
int main()
{
void judge(int result,int chance);
int add(int a ,int b);
printf("请输入两个整数:");
scanf("%d%d",&a,&b);
chance=0;
do
{
result=add(a,b);
......................
阅读全部 | a13513909244 贴于 2018年11月24日 20:00     hide bbsi
Loaded 'APP01.EXE', no matching symbolic information found.
Loaded 'C:\Windows\SysWOW64\kernel32.dll', no matching symbolic information found.
Loaded 'C:\Windows\SysWOW64\KernelBase.dll', no matching symbolic information found.
The thread 0x744 has exited with code 21 (0x15).
The program 'F:\C程序练习\Debug\nn.exe' has exited with code 21 (0x15).

C语言单步调试出现上面错误,一闪就消失
Windows10系统 VCC+6.0
谢谢大家
阅读全部 | 格格呀 贴于 2018年11月20日 17:26     hide bbsi
#include<stdio.h>
int a[20][100005];
int main()
{
    int T,i,j=0,x[20],y[20],p=0,sum=0,summax[20];
int N[20];
    scanf("%d",&T);
    for(j=0;j<T;j++)
{ sum=0;
    scanf("%d",&N[j]);
    for(i=0;i<N[j];i++)
        scanf("%d",&a[j][i]);
......................
阅读全部 | liuyaxing 贴于 2018年11月20日 16:50     hide bbsi
While((ch=getchar())=='e') 
printf(" *" );
//怎么运算的?
阅读全部 | 闲人和尚 贴于 2018年11月13日 22:12     hide bbsi
#include <stdio.h>
main()
 {
 getch();
 }
阅读全部 | zc2546885976 贴于 2018年11月13日 08:28     hide bbsi
上一页 57 58 59 60 61 62 63 64 65 66 下一页