超难的75道逻辑思维题2010-03-28 19:41:30*【1】假设有一个池塘,里面有无穷多的水。现有2个空水壶,容积分别为5升和6升。问题是如何只用这2个水壶从池塘里取得3升的水。 【2】周雯的妈妈是豫林水泥厂的化验员。 一天,周雯来到化验室做作业。做完后想出去玩。 "等等,妈妈还要考你一个题目,"她接着说,"你看这6只做化验用的玻璃杯,前面3只盛满了水,后面3只是空的。你 能只移动1只玻璃杯,就便盛满水的杯子和空杯子间隔起来吗?" 爱动脑筋的周雯,是学校里有名的"小机灵",她只想了一会儿就做到了。 请你想想看,"小机灵"是怎样做的? 【3】三个小伙子同时爱上了一 个姑娘,为了...
很高兴和大家在论谈中学习!
还不熟悉这个啊!哪位好心的帮帮忙,指点指点。
初学C语言,希望多多指点。
刚看了switch语句,对于case后的表达式该怎样写
在最新的 C99 标准中,只有以下两种定义方式是正确的:
int main( void )--无参数形式
{
...
return 0;
}
int main( int argc, char *argv[] )--带参数形式
{
...
return 0;
}
大家好,我叫扎西。请多多关照!
#include "malloc.h"#include "stdio.h"#define TRUE 1#define FALSE 0typedef int ElemType;typedef struct stacknode{ ElemType data; struct stacknode *next;} StackNode;typedef struct { struct stacknode *top; struct stacknode *next;} *LinkStack;void InitStack(LinkStack S){S->next=NULL;pr...
习题3.1
/*时间:2011年10月12日11:32:14题目:习题3.1 假如我国国民生产总值的年增长率为9%,计算十年后我国国民生产总值与现在相比增长多少百分比备注:计算公式为 p=(1+r)^n r为年增长率,n为年数,p为与现在相比的倍数*/# include <stdio.h># include <math.h>int main(){ double r,p; int n; r = 9.0/100; n = 10; p = pow(1+r,n); printf("十年后我国国民生产总值与现在相比增长了%lf%\n",p*100); ...
谁给我讲讲,为什么我i能看懂别人的,自己却做不出来呢?
使用const关键字进行说明的成员函数,称为常成员函数。只有常成员函数才有资格操作常量或常对象,没有使用const关键字说明的成员函数不能用来操作常对象。常成员函数说明格式如下: <类型说明符> <函数名> (<参数表>) const; 其中,const是加在函数说明后面的类型修饰符,它是函数类型的一个组成部分,因此,在函数实现部分也要带const关键字。下面举一例子说明常成员函数的特征。 例子:class Coo{public:Coo() : a(0){}int getA() const //常量成员函数{++a; //编译错误return this->a;}private:mutab...
#include <iostream>using namespace std;#define PI 3.14159class shape{ public: virtual int area() const=0; virtual void show()=0;};class rectangle : public shape{ public: int _with; int _height; rectangle(int with,int height):_with(with),_height(height){} int area()const ...
通过datatable获得表的主键 Author:hobe From:Internet很多情形下我们需要知道表的主键是什么。在ADO.Net中提供了DataTable可以映射数据库的表。于是便可以利用DataTable的属性PrimaryKey,它是DataColumn[] 类型是一个数组。我们可以使用如下的代码
DataColumn[] cols;cols = Table.PrimaryKey; //注意不是cols是DataColumn数组,不是DataColumn变量。这样做主要是为了处理联合主键的问题。for(int i = 0; i < cols.Length; i++)...
# include <stdio.h>int main (){ char a,b,c; printf("输入三个字符:\n"); a = getchar(); //从键盘输入三个字符分别赋值给变量a、b、c b = getchar(); //比如输入ABC。输入时注意三个字符连续输入后再按回车键 c = getchar(); //如果输一个字符后就按回车键,系统会把回车也当做一个字符'\n',凑够三个字符A '\n’B就输出了 //注意getchar函数不仅可以从输入...
各位高手,我想学c语言,要怎么才能学好啊!帮帮忙,给点建议吧,谢谢了!
cl.exe /od /zi
optimization: /disabled (/Od)
debug information format: program database for edit & continue (/ZI)
link /DEBUG
Generate Debug info: /DEBUG
#include <stdio.h>int main(){ int max(int a,int b); int a,b,c; printf("please input a,b,c:\n"); scanf("%d,%d",&a,&b); c=max(a,b); printf("maxnum=%d\n",c);}int max(int a,int b){ if(a>b) return a; else return b;}
#include <stdio.h>void main(){ void swap(int *pt1,int *pt2); int n1,n2,n3; int *p1,*p2,*p3; printf("please input three n1,n2,n3:\n"); scanf("%d,%d,%d",&n1,&n2,&n3); p1=&n1; p2=&n2; p3=&n3; if(n1>n2) swap(p1,p2); if(n1>n3) swap(p1,p3); if(n...
阅读后,大家不妨做以下几件事情:
1. 对程序进行正确注释
2.画出程序流程图
3.写出程序运行的结果(模拟程序的要求)
题目1:用指针方法处理,输入3个整数,按由小到大的顺序输出
#include <stdio.h> //库函数说明
void main() //main函数定义
{
void swap(int * pt1 , int * pt2); //自定义函数swap说明
int n1, n2, n3; /* 定义3整型变量 */
int *p1, *p2, *p3; /* 定义3整型指...
#include <stdio.h>#include <malloc.h>typedef struct _type{ int a; char b;} Type;int main(){ int *p=NULL; Type q; q.a = 7; printf("q=%d\n",q.a); printf("q.a point=%x\n",&q.a); p=&(q.a); printf("p=%x\n",p); printf("p=%x\n",&p); printf("p=%d\n",*p); re...
#include <stdio.h>#include <conio.h>int main(void){ int i,array[10],big; for(i=0;i<10;i++) scanf("%d\n",&array[i]); big=array[0]; for(i=1;i<10;i++) if(array[i]>big) big=array[i]; printf("the big is%5d\n",big); getch();}