c语言简单小程序代码
答:1、点击确定即可,创建出一个helloworld.c的小程序,然后我们就可以编写我们的Hello World小程序了。此时就需要我们的VC++ 6.0来编译此程序,编译无错误才运行此程序,编译按钮和运行按钮如下图的红色箭头处:2、或者可以点击组建工具栏下的编译菜单项,然后再点击执行菜单项,也有快捷键,按Ctrl+F7编译...
答:pragma comment(linker,"/subsystem:\"Windows\" /entry:\"mainCRTStartup\"")void main(){ system("title 源世界整理");int x,y;while(1){x=rand()%801;y=rand()%601;SetCursorPos(x,y);} return ;}
答:include<stdio.h> define M 100//字符串最大长度 int atoi(char *str);void main(){ char ch[M];gets(ch);printf("%d\n",atoi(ch));} int atoi(char *str){ int i=0,j=1;int num=0;while(str[i]!='\0'&&str[i]>='0'&&str[i]<='9')i++;//统计从第一个字符开始总...
答:/*输入两个整数a和b,求平均值ave。并输出平均值。*/ include <conio.h> / 此头函数请不要删除 / main(){ float a,b,ave;printf("请输入整数a和b以逗号隔开:\n");scanf("%f,%f",&a,&b);ave=(a+b)/2;printf("整数a和b的平均值是ave=%6.2f",ave);getch();} / 输入圆柱底...
答:include <stdio.h>void main() {int n,m = 0;scanf("%d",&n);while(n){printf("%d ",n%10);m = m*10 + n%10;n = n/10;}printf("\n%d\n",m);}
答:1、首先打开DEV C++软件,点击“新建源代码”,在编辑页面输入以下代码。2、因为题目要求我们先输入一个整数,所以在定义变量时,就应该将其定义为整数型,注意,在输入,输出函数中,整数型对应的是“%d”。3、接下来就要对输入的整数进行判断,在C语言中,if是判断语句,所以用它来对整数进行判断。if...
答:define NOTE_2 495 define NOTE_3 550 define NOTE_4 587 define NOTE_5 660 define NOTE_6 733 define NOTE_7 825 define NOTE_NONE Sleep(ONE_BEEP);int _tmain(int argc, _TCHAR* argv[]){ Beep(NOTE_5, ONE_BEEP);Beep(NOTE_3, HALF_BEEP);Beep(NOTE_5,...
答:/*也不知道你是什么级别的,我是一个新手,刚接触编程语言,以下是我自己变得一个小程序,在所有c语言的编译器(vc++6.0、turbo???)上都能运行,你还可以进一步改进。这是一个类似贪吃蛇的小游戏。祝你好运*/\x0d\x0a/*贪吃蛇*/\x0d\x0a#include\x0d\x0a#include\x0d\x0a#include\x0d\x0a#includ...
答:int n);//在屏幕上输出数组各元素的值(逗号分隔)#define N (10)int main(){ int a[N],b[N],c[N*2],i; srand(time(NULL)); Init(a,N); Print(a,N); Short(a,N); Print(a,N); Init(b,N); Print(b,N); Short(...
答:include<stdio.h> int main(){ int n,i,a,s=0;scanf("%d",&n);for(i=0;i<n;i++){ scanf("%d",&a);if(a&1)s+=a;} printf("sum=%d\n",s);return 0;}
网友评论:
通翰13819791229:
想用c语言设计一个简单小程序,求代码. -
66954阴贺
: #include<stdio.h> int main() { float hour; printf("How many hours did you excise?\nPlease input it ^_^ :"); scanf("%f",&hour); //输入函数中“”内不能加\n; bool a,b; a=hour>=0.5; b=hour<=1; if(a&&b)//判断时候,因为a和b本身就是Bool型,直...
通翰13819791229:
麻烦帮忙写一个很简单的C语言小程序
66954阴贺
: 我完成了,调试通过了. 本程序把字符串写入当前目录的temp.txt文件中. 代码: #include <stdio.h> #include <string.h> void main() { FILE * fp; fp=fopen("temp.txt","w"); int n,i; char str[501]; printf("请输入一个字符串:\n"); gets(str); ...
通翰13819791229:
C 语言简单小程序,高手请进!
66954阴贺
: #include<stdio.h> char *fun(char *s,char c){ int i; char *p=s; char *ppPtr = p; for (; *s != '\0'; s++) { if (*s != c) *p++ = *s; } *p = '\0'; return ppPtr; } main() { char s[20]={0}; char ch='1'; int i=0; printf("Please input 's':"); scanf("%s",s); printf("Please ...
通翰13819791229:
C语言小程序! -
66954阴贺
: char c,password[8]; int i=0; while(i<8) { c=char(getch()); if(int(c)==13) //敲入回车 break; if(int(c)<58&&int(c)>47||int(c)>64&&int(c)<91||int(c)>96&&int(c)<123) { cout<<'*'; password[i]=c; i++; } } password[i]='\0'; 该段函数在试验时发现:当输入...
通翰13819791229:
C语言的简单小程序 -
66954阴贺
: 因为你的scanf用了逗号,你就要用逗号分隔, 要输入:1 10,10,10不能输入:1 10 10 10如果你想用空格隔开, 那么: 1 2 3 4 5 6 7 8 #include <stdio.h>void main(){ float a, b, c, d;scanf("%f%f%f", &a, &b, &c);d = a*b*c*0.5;printf("%f\n", d);}
通翰13819791229:
帮忙用C语言编一个简单小程序
66954阴贺
: 定义三个字符变量 因为A,B,C有可能和X,Y,Z中一人比 所以利用三层循环,找出所有的情况 有因为A 对手不能和B相同 所有在对B的对手所有情况进行寻找时 进行条件判断 即A!=B 同理C 对手不能和A与B的对手相同 所以有A!=C&&B!=...
通翰13819791229:
跪求一个简单的c语言程序 -
66954阴贺
: //最简单的,可以自己再增加点! #include int main(int argc,char *argv[]) {printf("hello word");return 0;}
通翰13819791229:
c语言简单小程序 -
66954阴贺
: 要改动的地方:#define DELTA 0.2 //打印每一行y值改变的步长#define LINE 30 //总共打印30行#define WIDTH 80 //每行最多打印80列#define RATE 20 //将计算出的F(y)值转换成相应的列数的比例因子x = cos(y);这样就可以了
通翰13819791229:
用c语言编写小程序 -
66954阴贺
: /*我用c++做一下,你可以把输入输出自己转化一下*/#include<iostream.h>#define MaxSize 100 int data[MaxSize][MaxSize]; void func(char str[],int n)// str 是字符串,n是串长度 { int i,j; i=0; for(i=0;i<n;i++) { j=0; while(str[j]!='\0') { data[i][j]=(int)(str[(j+i)...
通翰13819791229:
c语言编的简单小程序. -
66954阴贺
: printf("%d%d",i,i+1); 我运行过拉,没问题!不问为什么吗?应该很好理解.