自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(81)
  • 收藏
  • 关注

原创 sum_arr1.c

#include <stdio.h>#define SIZE 10int sum(int ar[],int n);int main(int argc, const char * argv[]) { int marbles[SIZE] = {20,10,5,39,4,16,19,26,31,20}; long answer; answer=sum(marbles,SIZE); printf("The total number of marbles is %ld

2020-05-22 11:50:21 181

原创 echo.c

#include <stdio.h>int main(int argc, const char * argv[]) { char ch; while ((ch=getchar())!='#') { putchar(ch); } printf("\n"); return 0;}

2020-05-22 11:41:34 290

原创 day_mon.c -- 打印每个月的天数

//day_mon.c -- 打印每个月的天数#include <stdio.h>#define MONTHS 12int main(int argc, const char * argv[]) { int days[MONTHS] = {31,28,31,30,31,30,31,31,30,31,30,31}; int index; for (index=0; index<MONTHS; index++) { printf("Month %

2020-05-14 15:56:52 365

原创 factors.c -- 使用递归和循环计算阶乘

//factors.c -- 使用递归和循环计算阶乘#include <stdio.h>long fact(int n);long rfact(int n);int main(int argc, const char * argv[]) { int num; printf("This program calculates factorails.\n"); printf("Enter a value in the range 0-12 (q to quit):\n

2020-05-14 15:05:39 220

原创 lesser.c

//lesser.c -- 找出两个整数中较小的一个#include <stdio.h>int imin(int,int);int main(int argc, const char * argv[]) { int evil1,evil2; printf("Enter a pair of integers(q to quit):\n"); while (scanf("%d %d",&evil1,&evil2) == 2) { pri

2020-05-14 13:55:45 193

原创 lethead.c

//lethead.c#include <stdio.h>#define NAME "GIGATHINK,INC."#define ADDRESS "101 Megabuck Plaza"#define PLASE "Megapolis.CA 94904"#define WIDTH 40void starbar(void); //声明函数int main(int argc, const char * argv[]) { starbar(); printf("%

2020-05-14 13:34:06 172

原创 paint.c

//paint.c -- 使用条件运算符#include <stdio.h>#define COVERAGE 350 //每罐油漆可刷的面积(单位:平方英尺)int main(int argc, const char * argv[]) { int sq_feet; int cans; printf("Enter the number of square feet to be painted:\n"); while (scanf("%d",&sq_

2020-05-14 09:30:25 244

原创 chcount.c

//chcount.c -- 使用逻辑与运算符#include <stdio.h>#define PERIOD '.'int main(int argc, const char * argv[]) { char ch; int charcount=0; while ((ch=getchar())!=PERIOD) { if (ch!='"'&&ch!='\'') { charcount++;

2020-05-14 08:32:59 152

原创 divisors.c

//divisors.c -- 使用嵌套的if语句显示一个数的约数#include <stdio.h>#include <stdbool.h>int main(int argc, const char * argv[]) { unsigned long num; //待测试的树 unsigned long div; //可能的约数 bool isPrime; //素数标记 printf("Please enter an integer

2020-05-14 08:22:08 187

原创 do_while.c

//do_while.c -- 出口条件循环#include <stdio.h>int main(int argc, const char * argv[]) { const int secret_code=13; int code_entered; do { printf("To enter the triskaidekaphoia therapy club,\n"); printf("please enter the secre

2020-05-13 11:25:18 103

原创 Boolean.c

//boolean.c -- 使用_Bool类型的变量 variable#include <stdio.h>int main(int argc, const char * argv[]) { int num; int sum=0; _Bool input_is_good; printf("Please enter an integer to be summed"); printf("(q to quit):"); input_is_goo

2020-05-13 10:55:01 152

原创 t_and_f.c

//t_and_f.c --C中的真和假的值#include <stdio.h>int main(int argc, const char * argv[]) { int true_val,false_val; true_val=(10>2); //关系为真的值 false_val=(10==2);//关系为假的值 printf("true=%d;false=%d\n",true_val,false_val); return 0;}

2020-05-13 10:35:24 195

原创 wheat.c

//wheat.c -- 指数增长#include <stdio.h>#define SQUARES 64int main(int argc, const char * argv[]) { const double CROP=2E16; //世界小麦年产谷物数 double current,total; int count=1; printf("square grains total "); printf(" fra

2020-05-13 08:37:37 161

原创 字符串.c

#include <stdio.h>#include <string.h>int main(int argc, const char * argv[]) { char name[40]; printf("请输入您的名:"); scanf("%s",name); printf("\"%s\"\n",name); printf("\"%20s\"\n",name); printf("\"%-20s\"\n",name);

2020-05-12 14:51:37 109

原创 名姓--姓名

#include <stdio.h>int main(int argc, const char * argv[]) { char name[40]; char first[40]; printf("请输入您的名 姓:"); scanf("%s %s", first,name); printf("您的姓 名分别是:%s %s\n",name,first); return 0;}...

2020-05-12 14:33:29 155

原创 balkback.c

//talkback.c -- 演示与用户的交互#include <stdio.h>#include <string.h> //提供strlen()函数的原型#define DENSITY 62.4 //人体密度(单位:磅/立方英尺)int main(int argc, const char * argv[]) { float weight,volume; int size,letters; char name[40]; //name 是一个

2020-05-12 14:05:25 149

原创 prntval.c

//prntval.c -- printf()的返回值#include <stdio.h>int main(int argc, const char * argv[]) { int bph2o=212; int rv; rv=printf("%d F is the water's boiling point.\n",bph2o); printf("The printf() function printed %d characters.\n",rv);

2020-05-12 10:48:42 145

原创 width.c

//width.c -- 字符宽度#include <stdio.h>#define PAGES 959int main(int argc, const char * argv[]) { printf("*%d*\n",PAGES); printf("*%2d*\n",PAGES); printf("*%10d*\n",PAGES); printf("*%-10d*\n",PAGES); return 0;}

2020-05-12 10:28:09 221

原创 define

#include <stdio.h>#include <limits.h>#include <float.h>int main(int argc, const char * argv[]) { printf("Some number limits for this system:\n"); printf("Biggest int:%d\n",INT_MAX); printf("Smallest long long:%lld\n",LLONG_

2020-05-12 10:01:13 97

原创 pizza

// pizza.c--在此披萨程序中使用已定义的常量#include <stdio.h>#define PI 3.14159int main(int argc, const char * argv[]) { float area,circum,radius; printf("What is the radius of your pizza:"); scanf("%f",&radius); area=radius*radius*PI; ci

2020-05-12 09:36:14 192

原创 数据与C 5

#include <stdio.h>int main(int argc, const char * argv[]) { double x,t; printf("请输入水的夸克数:"); scanf("%lf",&x); t=x*950/3.0e-23; printf("水分子的数目是:%f\n",t); return 0;}

2020-05-10 09:52:34 86

原创 数据与C 4

#include <stdio.h>int main(int argc, const char * argv[]) { double x,t; printf("请输入年龄: "); scanf("%lf",&x); t=3.156e7*x; printf("您已经活了%f秒。\n",t); return 0;}

2020-05-10 09:45:39 105

原创 数据与C 3

#include <stdio.h>int main(int argc, const char * argv[]) { float a; printf("Enter a floating-point value:"); scanf("%f",&a); printf("fixed-point notation:%f\n",a); printf("exponential notation:%e\n",a); printf("p notati

2020-05-10 09:35:33 113

原创 数据与C 2

#include <stdio.h>int main(int argc, const char * argv[]) { printf("\a"); printf("Startled by the sudden sound,Sally shouted,\n"); printf("\"By the Great Pumpkin,what was that!\"\n"); return 0;}

2020-05-10 09:14:46 80

原创 数据和C 1

#include <stdio.h>int main(int argc, const char * argv[]) { char a; scanf("%d",&a); printf("这个字符是:%c\n",a); return 0;}

2020-05-10 09:09:13 123

原创 求最大值

#include <stdio.h>int main(int argc, const char * argv[]) { int a,b,c; scanf("%d %d",&a,&b); c=max(a,b); printf("max is %d.\n",c);} int x,y;max(x,y) { int z; z=x>y?x:y; return(z);}

2020-05-09 20:28:43 123

原创 把年龄转化为天数

#include <stdio.h>int main(int argc, const char * argv[]) { int x; int a; scanf("%d",&x); a=x*365; printf("我已经出生%d天了。\n",a); return 0;}

2020-05-08 20:50:06 605

原创 打印姓和名

#include <stdio.h>int main(int argc, const char * argv[]) { printf("sunshine\n"); printf("qinger\nsunshine\n"); printf("Sunshine-qinger\n"); return 0;}

2020-05-08 20:44:52 161

原创 first

#include <stdio.h>int main(int argc, const char * argv[]) { int num; num=1; printf("I am a simple"); printf("computer.\n"); printf("My favorite number is %d because it is first.\n",num); return 0;}

2020-05-08 20:29:52 94

原创 1-10,20-30,35-45的(函数)求和

#include <stdio.h>void sum(int begin,int end) { int i; int sum=0; for (i=begin; i<=end; i++) { sum+=i; } printf("%d到%d的和是%d\n",begin,e...

2020-05-06 12:53:26 829

原创 输出由abc组成的三位数2

#include <stdio.h> int main(int argc, const char * argv[]) { int a; int i,j,k; scanf("%d",&a); int cnt; i=a; while (i<=a+3) { ...

2020-05-04 10:25:40 137

原创 大小写字母的转换

#include <stdio.h>int main(int argc, const char * argv[]) { char a,c; scanf("%c %c",&a,&c); a=a+32;//大写化为小写 c=c-32;//小写化为大写 printf("%c %c\n",a,c); return 0;}...

2020-05-04 09:46:48 260

原创 字符的计算

#include <stdio.h>int main(int argc, const char * argv[]) { char c='A'; c++; printf("%c\n",c); int b='Z'-'A'; printf("%d\n",b); return 0;}

2020-05-04 09:27:41 1086

原创 混合的输入输出

#include <stdio.h>int main(int argc, const char * argv[]) { char c; int i; scanf("%d %c",&i,&c); printf("%d %c\n",i,c); printf("i=%d,c='%c',c=%d\n",i,c,c); retu...

2020-05-04 09:19:18 679

原创 字符的输入输出

#include <stdio.h>int main(int argc, const char * argv[]) { char c; scanf("%c",&c); printf("c=%d\n",c); printf("c='%c'\n",c); return 0;}

2020-05-03 17:43:10 319

原创 浮点运算的精度

#include <stdio.h>int main(int argc, const char * argv[]) { float a=1.345f; float b=1.123f; float c=0; c=a+b; if (c==2.468) { printf("相等!\n"); }else print...

2020-05-03 17:23:06 195

原创 浮点数的不存在和无穷形式

#include <stdio.h>int main(int argc, const char * argv[]) { printf("%f\n",12.0/0.0); printf("%f\n",-12.0/0.0); printf("%f\n",0.0/0.0); return 0;}

2020-05-03 17:16:36 180

原创 sizeof()

#include <stdio.h>int main(int argc, const char * argv[]) { int a; a=9; printf("sizeof(int)=%ld\n",sizeof(int)); printf("sizeof(a)=%ld\n",sizeof(a)); return 0;}

2020-05-01 16:27:15 116

原创 约分最简分式

#include <stdio.h>int main(int argc, const char * argv[]) { int divisor,dividend; scanf("%d/%d",&dividend,&divisor); int a=dividend,b=divisor; int t; while (b>0)...

2020-05-01 15:58:13 301

原创 序列前N项和

#include <stdio.h>int main(int argc, const char * argv[]) { double t; double divisor=1,dividend=2; double sum=0.0; int i,n; scanf("%d",&n); for (i=1; i<=n; i++) ...

2020-05-01 15:50:43 188

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除