#include <stdio.h>//输入输出头文件

#include<string.h>

#include<stdlib.h>

//局部被调用函数1 成绩检测

void test(){

int b;

printf("请输入你的成绩\n");

scanf("%d",&b);

if (b>=0&&b<=100) {

printf("分数正常\n等待分析。。。\n");

if (b<60)

printf("笨蛋,你考试不及格了。\n");

else if(b<80)

printf("还好,你及格了\n");

else

printf("你很好,干得漂亮。\n");

}

else

printf("输入分数错误,笨蛋\n");

}

//局部函数2   水仙花数

void test1(){      //单个检测

int h,i,j,l;

printf("请输入一个三位数:\n");

scanf("%d",&l);

h=l/100;

i=l/10-h*10;

j=l%10;

if (l==i*i*i+j*j*j+h*h*h){

printf("%d 是水仙花数\n",l);

}

else

printf("%d 不是水仙花数\n",l);

}

void test2(){//自动检测

printf("输出从输入数字r到999之间的水仙花数\n");

int o,p,q,r;

scanf("%d",&r);

while(r<=999)

{

o=r/100;

p=r/10-o*10;

q=r%10;//赋值于大括号内多次赋值,外只赋值一次。

if (r==o*o*o+p*p*p+q*q*q)

{

printf("%d 是水仙花数\n",r);

}

r++;

}

}

void test3(){   //打印星图

int x,y,z;

x=5;

y=0;

for (y=0; y<5; y++) {

for (z=1; z<=x+y; z++) {

if (z<x-y) {

printf(" ");//此处可为空格或小横杠等各种第二排键盘图案。

}

else

printf("*");

}

printf("\n");

}

printf("fcwm\n");

}

void test4(){//输出田字

int i,j;

for (i=0; i<=4; i++) {

for (j=0; j<=4; j++) {

if (i%2==0||j%2==0)

printf("*");

else printf(" ");

}printf("\n");

}

printf("fcwm\n");

}

//主函数

int main(int argc, const char * argv[]) {

// insert code here...

test();

test1();//shuixianhua  dange

test2();//shuixianhua  zidong

test3();//dayinxingtu  zd

test4();

/* int a=12;

if (a<12) {

printf("a<12");

}

else{

printf("a is not <12\n");

}*/

/*

//输入多人成绩,查看结果;

while (a<100) {//调用while循环

test();//jiancechengjidengji

a++;

}

*/

return 0;

}

C语言成绩测试 ,水仙花数,打印星图的更多相关文章

  1. C语言基础之水仙花数

    题目:打印出所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其各位数字立方和等于该数本身. 例如:153是一个“水仙花数”,因为153=1的三次方+5的三次方+3的三次方. 程序分析:利用for循 ...

  2. Linux下用Bash语言实现输出水仙花数的功能

    题目链接: 题目描述 打印出所有"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该本身. 例如:153是一个水仙花数,因为153=1^3+5^ ...

  3. Java语言写出水仙花数,

    package com.llh.demo;/** * 水仙花数 * @author llh * */public class Demo14 {    public static void main(S ...

  4. C语言实现的水仙花数

    #include <stdio.h>void main(){ int ge,shi,bai;      for (int i =100; i < 1000; i++)     {   ...

  5. C语言 · 4-3水仙花数

    问题描述 打印所有100至999之间的水仙花数.所谓水仙花数是指满足其各位数字立方和为该数字本身的整数,例如 153=1^3+5^3+3^3. 样例输入 一个满足题目要求的输入范例.例:无 样例输出 ...

  6. Java程序设计之打印100~999的水仙花数

    package printDaffodilNumber; /* * 题目:打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身 ...

  7. C语言与水仙花数

    C语言与水仙花数 水仙花数:前提三位数,"个位数的立方"加上"十位数的立方"加上"百位数的立方"恰好等于这个数. 我们来用C语言书写水仙花数 ...

  8. 题目:打印出所有的 "水仙花数 ",所谓 "水仙花数 "是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个 "水仙花 数 ",因为153=1的三次方+5的三次方+3的三次方。

    题目:打印出所有的 "水仙花数 ",所谓 "水仙花数 "是指一个三位数,其各位数字立方和等于该数本身.例如:153是一个 "水仙花 数 ", ...

  9. 基于visual Studio2013解决C语言竞赛题之0412水仙花数

       题目 解决代码及点评 按照题目要求,3位数是从100~999,那么我们设计一个for循环遍历所有三位数 对每个三位数进行水仙花数的判断即可 /******************** ...

随机推荐

  1. WPF 之 设置Dialog的父窗体

    1.如果弹出窗体(如ChildWindow),调用Show方法,并且设置了其Owner属性: ClassRootWindow { void Foo() { ChildWindow cw = newCh ...

  2. shake震动动画

  3. Boost.Any

    支持类型安全地存储和获取任意类型的值 #include <list> #include <boost/any.hpp> #include <string> #inc ...

  4. Android 高级UI设计笔记18:实现圆角图片

    1. 下面我们经常在APP中看到的圆角图片,如下: 再比如:微信聊天会话列表的头像是圆角的. 2. 下面分析一个Github的经典: (1)Github库地址: https://github.com/ ...

  5. 12. Android框架和工具之 StringUtils(字符串操作)

    1. StringUtils介绍: StringUtils是apache commons lang库(http://commons.apache.org/proper/commons-lang/dow ...

  6. Java基础知识强化之IO流笔记78:NIO之 FileChannel

    Java NIO中的FileChannel是一个连接到文件的通道.可以通过文件通道读写文件. FileChannel无法设置为非阻塞模式,它总是运行在阻塞模式下. 1. 打开FileChannel 在 ...

  7. iis8 默认不支持svc解决方法

    最近在IIS8中发布WCF服务应用时,发现IIS8不支持WCF服务svc请求,后来发现IIS8缺少对WCF服务的Managed Handler,按照以下步骤添加后,IIS8即支持WCF服务. 1. 首 ...

  8. iOS平常注意1

    在写oc代码时的注意有一些错误看看各位朋友在平常注意了编写是的小错误我也会不断总结的 1. [NSTimer scheduledTimerWithTimeInterval:1 target:self ...

  9. error和exception的区别,RuntimeException和非RuntimeException的区别

    error和exception的区别,RuntimeException和非RuntimeException的区别   1. 异常机制       异常机制是指当程序出现错误后,程序如何处理.具体来说, ...

  10. Java中Integer的最大值和最小值

    从JDK1.0开始,Integer中就定义了MIN_VALUE和MAX-VALUE两个常量: /** * A constant holding the minimum value an {@code ...