dkfr.net
当前位置:首页 >> 谁能帮我用C语言将此题的程序编写出来:任意输入某... >>

谁能帮我用C语言将此题的程序编写出来:任意输入某...

#include int main() { int i,j,m,n,k; int a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; float y,m1,k1; printf("欢迎你使用万年历,请输入你要查询的年数:"); while(scanf("%f",&y)) {n=(int)((y-1)/3324); m1=(int)((y-1)/100); m=(int)(m...

代码: #include void main () { float x; int i,z=0,f=0,l=0; for(i=1;i0) z++; else if(x

#include int main() { char str[100]; unsigned char i = 0; int tmp; printf("please input a string:"); scanf("%s",str); while(*(str +i) != '\0') { tmp = (int)(*(str + i)); printf("%d\n",tmp); i++; } system("pause"); return 0; }

#include #define N 3 void main() { int num,a[N],j,i=0; printf("please enter a number change from 100 to 999:\n"); scanf("%d",&num); while(num!=0)//将各位数分离出来并装如数组中 { a[i++]=num%10; num/=10; } for(j=0;j

此类问题属于基础题,比较简单,一条输出语句即可。 #include void main(){int num1,num2,num3;scanf("%d%d%d",&num1,&num2,&num3);printf("%d",(num1>num2?num1:num2)>num3?num1>num2?num1:num2:num3);}如果要往复杂的形式写,可以用if else 语...

int main() { int a,b,c,sum; printf("请输入三个任意整数:") ; scanf(%d%d%d,&a,&b,&c); sum=a+b+c; printf("这三个整数和为%d;平均数为%.2f",sum,sum/3.0) return 0; }

源程序如下:#include void main() { int x,y,a[32],i=0; printf("请输入一个十进制整数.\n"); scanf("%d",&y); x=y; while(x!=0) { a[i++]=x%2; //将结果存放到数组中 x=x/2; } printf("十进制整数%d转换为二进制数是:\n",y); for(i--;i>=0;i--...

方法一: //用数学函数#include#includevoid main(){int a;scanf("%d",&a);printf("%d\n",abs(a));} 方法二://判断#includevoid main(){int a;scanf("%d",&a);if(a>=0)printf("%d\n",a);elseprintf("%d\n",-a);} Problem Description 求实数的...

#include"stdio.h"int main(){ do{ int num; printf("主菜单项:\n1-预览添加\n2-查找修改\n3-删除\n0-退出系统\n"); printf("请选择操作:"); scanf("%d",&num); switch (m) { case 1: printf("***信息预览添加***\n"); break; case 2: printf(...

把不是数字字符“自己向自己拷贝”即可。举例代码如下: //#include "stdafx.h"//If the vc++6.0, with this line.#include "stdio.h"int main(void){char str[500]; int i,j; printf("Input a string...\nstr="); scanf("%s",str); for(j=i=0;str...

网站首页 | 网站地图
All rights reserved Powered by www.dkfr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com