Dec
15

[备忘]哈佛图书馆自习室墙上的训言

转自网上,不管真假,我觉得很有教育意义,在此收藏以作备忘.
        1. This moment will nap, you will have a dream; But this moment study,you will interpret a dream.

2. I leave uncultivated today, was precisely yesterday perishestomorrow which person of the body implored.

3. Thought is already is late, exactly is the earliest time.

4. Not matter of the today will drag tomorrow.

5. Time the study pain is temporary, has not learned the pain islife-long.

6. Studies this matter, lacks the time, but is lacks diligently.

7. Perhaps happiness does not arrange the position, but succeeds mustarrange the position.

8. The study certainly is not the life complete. But, sincecontinually life part of - studies also is unable to conquer, what butalso can make?

9. Please enjoy the pain which is unable to avoid.

10. Only has compared to the others early, diligently diligently, canfeel the successful taste.

11. Nobody can casually succeed, it comes from the thoroughself-control and the will.

12. The time is passing.

13. Now drips the saliva, will become tomorrow the tear.

14. The dog equally study, the gentleman equally plays.

15. Today does not walk, will have to run tomorrow.

16. The investment future person will be, will be loyal to the realityperson.

17. The education level represents the income.

18. One day, has not been able again to come.

19. Even if the present, the match does not stop changes the page.

20. Has not been difficult, then does not have attains 

1.此刻打盹,你将做梦;而此刻学习,你将圆梦。

2.我荒废的今日,正是昨日殒身之人祈求的明日。

3.觉得为时已晚的时候,恰恰是最早的时候。

4.勿将今日之事拖到明日。

5.学习时的苦痛是暂时的,未学到的痛苦是终生的。

6.学习这件事,不是缺乏时间,而是缺乏努力。

7.幸福或许不排名次,但成功必排名次。

8.学习并不是人生的全部。但,既然连人生的一部分——学习也无法征服,还能做什么呢?

9.请享受无法回避的痛苦。

10.只有比别人更早、更勤奋地努力,才能尝到成功的滋味。

11.谁也不能随随便便成功,它来自彻底的自我管理和毅力。

12.时间在流逝。

13.现在淌的哈喇子,将成为明天的眼泪。

14.狗一样地学,绅士一样地玩。

15.今天不走,明天要跑。

16.投资未来的人是,忠于现实的人。

17.教育程度代表收入。

18.一天过完,不会再来。

19.即使现在,对手也不停地翻动书页。

20.没有艰辛,便无所获。

...
阅读全文
Dec
11

DayDream

今早的网页编程基础学Fireworks,无聊之余为自己作了一张1024*768的桌面,取名为"幻灭的梦---DayDream",中间那段文字引用了鲁迅先生的《野草》的题辞.我清楚地记得宋岳庭有一首Rap也叫Daydream,词写得很不错,推荐.
 png文件
 gif文件

...
阅读全文
Nov
20

Flash作业

两星期前老师布置的作业:充分发挥自己的创作能力,制作一个Flash动画.昨晚开始动手做,两三分钟草草了之,今早上课就提交了.看到同学们个个用心制作的动画,长度好几分钟,运用了各种特效,创意十足.相比之下,我这个简陋的一帧二行代码四个图层的动画,相当惭愧...

...
阅读全文
Nov
16

Fibonacci数列(数组)

今天的程序设计基础课的作业,用数组输出Fibonacci数列.
#include <stdio.h>
#define SIZE 20
void main()
{
    int iArray[20] = {0};
    int iIndex = 0;
    iArray[0] = 1;
    iArray[1] = 1;
    for (iIndex = 2;iIndex < SIZE;iIndex = iIndex + 1)
    {
        iArray[iIndex] = iArray[iIndex - 2] + iArray[iIndex - 1];
    }
    printf("%d\t%d\t",iArray[0],iArray[1]);
    for (iIndex = 2;iIndex < SIZE;iIndex = iIndex + 1)
    {
        if (iIndex % 5 == 0)
        {
            printf("\n",iIndex,iArray[iIndex]);
        }
        printf("%d\t",iArray[iIndex]);
    }
    getch();
}

...
阅读全文
Nov
14

Fibonacci数列

这是上星期程序设计基础一道提高练习题,对我来说颇有难度,刚开始做时一头雾水,不知从何下手,想了好久毫无收获.昨晚再次翻出这道题来做时,我试着将它用流程图表示出来,写着写着程序代码已跃然涌现于脑海之中,最终在Win-TC调试运行成功了.虽然代码冗长了些,不过我已明白流程图在编程中的重要性.
输出Fibonacci数列(前两个数为1,后面的数等于在它前面的两个数的和)的前20个数,要求输出四个数后就换行.
#include <stdio.h>
void main()
{
    int iA = 1,iB = 1,iSum = 0,iTemp = 0,iCount = 0;
    printf("%d\t%d\t",iA,iB);
    iTemp = iA + iB;
    printf("%d\t",iTemp);
    iSum = iTemp + iB;
    printf("%d\n",iSum);
    do
    {
        iTemp = iSum+iTemp;
        printf("%d\t",iTemp);
        iSum = iSum + iTemp;
        printf("%d\t",iSum);
        iTemp = iSum+iTemp;
        printf("%d\t",iTemp);
        iSum = iSum + iTemp;
        printf("%d\n",iSum);
        iCount = iCount + 1;
    }
    while (iCount < 4);
    getch();
}

...
阅读全文
Oct
26

个人工资所得税的计算(switch)

上个月已经用if语句做过这道题,今天要用刚学的switch语句实现,中午牺牲午睡的时间跑去图书馆完成了.本以为上次用if语句做出这道题后,这次用switch-case语句也应该没问题,结果却花费了我不少时间才完成.看来军训回来后头脑变钝了好多:P
大致思路和if语句差不多,我认为用switch-case语句做这道题有两个关键也是难点,一是switch后面的整型表达式该如何表达,二是case后面的常量表达式又该如何安排.我再次仔细阅读了原题,根据它的分段标准及规律,才有了上面的安排.我发现有一点要注意,与上次嵌套选择语句不同,在if语句中,Income不必多次赋值,而这次是多分支选择语句,在switch-case语句中,由于每个case都是相对独立的,所以在每个case中的复合语句的Income都要重新赋值.

还有,上次在if语句中我将收入Income定义为浮点型,这次注意到了switch后面只能跟整型表达式,所以我将Income定义为整型,然后,Tax也下意识的定义为整型,问题出来了,结果运行时,得出的答案有些是正确的,有些比正确答案少1,后来才发现是Tax的类型问题,原来它应该被定义为浮点型.
最后改正完调试运行时,输入20000以内数字得出的结果均正确,不过我不明白,根据上面这段代码,当输入40000时,40000-1600=38400>0,而38400/500>76应该列入default范围内,因此应该可以算出结果,为什么显示的结果为No Tax呢?想了大半天,我才猛地想起老师曾经讲过,有符号整常数的范围是-32768~+32767,由于iIncome=iIncome-1600,所以iIncome的最大值应该是32767+1600=34367,据此我初步得出一个结论:当输入大于34367的整数时,也就是输入大于等于34368的整数时,显示的结果就为No Tax,于是我测试了一下,果真如此.但是当我把这段代码去掉getch();这一行后放到VC++下面执行时,并无此问题......
[updated]后来请教sic研发部的戴师兄才知道,编译器不同,int代表的值也不同,在Win-TC下,int的值只有两个字节,而在VC++下,int的值是4个字节,所以范围就更广了.

#include <stdio.h>
void main()
{
    int iIncome = 0;
    float fTax = 0.0;
    scanf("%d",&iIncome);
    iIncome = iIncome - 1600;
    if (iIncome > 0)
    {
        switch (iIncome / 500)
        {
            case 0:
                fTax = 0.05 * iIncome;
                break;
            case 1:
            case 2:
            case 3:
                iIncome = iIncome - 500;
                fTax = 0.05 * 500 + 0.10 * iIncome;
                break;
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
                iIncome = iIncome - 500 - 1500;
                fTax = 0.05 * 500 + 0.10 * 1500 + 0.15 * iIncome;
                break;
            default:
                iIncome = iIncome - 500 - 1500 - 3000;
                fTax = 0.05 * 500 + 0.10 * 1500 + 0.15 * 3000 + 0.20 * iIncome;
        }
        printf("Tax is %-4.2f",fTax);
    }
    else
    {
        printf("No Tax");
    }
    getch();
}

...
阅读全文
Oct
24

[分享]高质量C++/C 编程指南

与目前和我一样在学习程序设计基础的所有同志分享一本好书,这是我前几天向曾在华为工作的池老师索取企业编程规范时给我推荐的.据他介绍,这本书对C语言编程新手或老手都很有帮助,我大致看了一下,毕竟还是个新手,有很多地方看不懂,不过看懂的地方我都觉得很有用,因此拿来与大家分享.

        点击下载

...
阅读全文
Oct
5

密码输入程序

书上的一道练习:写出完整的程序,实现:输入密码,如果等于8848,则显示"Loading...",并退出循环;否则显示"Input again!".如果输入超过3次,则退出循环并结束程序.要求密码用ikeyword输入,用icount记录输入次数.
这主要考查循环语句的使用,非常简单,不过我只能写出while循环和do-while循环,for语句到现在还没想出来,哪位高手能指点一下呢?

while循环:
#include <stdio.h>
void main()
{
    int ikeyword=0,icount=0;
    printf("Please input the keyword!\n");
    scanf("%d",&ikeyword);
    while (ikeyword!=8848)
    {
        icount=icount+1;
        if (icount>=3)
        {
            break;
        }
        printf("Input again!\n");
        scanf("%d",&ikeyword);
    }
    if (ikeyword==8848)
    {
        printf("Loading...");
    }
    getch();
}

do-while循环:
#include <stdio.h>
void main()
{
    int ikeyword=0,icount=0;
    printf("Please input the keyword!\n");
    do
    {
        if (icount!=0)
        {
            printf("Input again!\n");
        }
            scanf("%d",&ikeyword);
            icount=icount+1;
        if (icount>=3)
        {
            break;
        }
    }
    while (ikeyword!=8848);
    if (ikeyword==8848)
    {
        printf("Loading...");
    }
    getch();
}

...
阅读全文
Oct
4

个人工资所得税的计算

下面是一道关于个人工资所得税的计算问题: 
个人工资所得税的计算:超过基准1600元以上的要纳税,超出基准的部分按下面的标准分段纳税:
         ◎不超过500元的部分,按5%纳税
         ◎超过500元至2000元的部分,按10%纳税
         ◎超过2000元至5000元的部分,按15%纳税
         ◎超过5000元至20000元的部分,按20%纳税 
要求:从键盘上输入一个20000元以内的工资,算出需要交纳的个人所得税,并输出。 
犯了一个低级错误(4000-1600=2200),结果折腾了半个小时才勉强写出一段能算出正确答案的代码,如下所示:

#include <stdio.h>
void main()
{
    float fIncome=0,fTax=0;
    scanf("%f",&fIncome);
    if (fIncome>1600)
    {
        fIncome=fIncome-1600;
        if (fIncome>500)
        {
            fIncome=fIncome-500;
            if (fIncome>1500)
            {
                fIncome=fIncome-1500;
                if (fIncome>3000)
                {
                    fIncome=fIncome-3000;
                    if (fIncome>15000)
                    {
                        fTax=0.20*fIncome+0.15*3000+0.10*1500+0.05*500;
                    }
                    else
                    {
                        fTax=0.20*fIncome+0.15*3000+0.10*1500+0.05*500;
                    }
                }
                else
                {
                    fTax=0.15*fIncome+0.10*1500+0.05*500;
                }
            }
            else
            {
                fTax=0.10*fIncome+0.05*500;
            }
        }
        else
        {
            fTax=0.05*fIncome;
        }
    }
    printf("The Tax is %3.2f",fTax);
    getch();
}

P.S.关于程序设计,早期在高中时曾接触过算法,那时学的只不过是一些简单的伪代码.上大学(三年制大专)后,学校开了程序设计基础这门课程,才第一次真正接触编程.在此之前,我觉得编程是那么的枯燥无聊,从未想过去接触它甚至去学习和研究它,直到今晚完成老师布置的一些简单的作业后,心中产生少许美妙的成就感,这时才对编程慢慢感兴趣...

...
阅读全文
分页:«1»

RSS订阅

    &25235;&34430; pageflakes Rojo &29399;&29399; google reader bloglines my yahoo newsgator netvibes &40092;&26524; &21738;&21522; &26377;&36947;

日历

<< 2008-8 >>

Sun

Mon

Tue

Wed

Thu

Fri

Sat

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

控制面板

最近引用

Search

站点统计

  • 文章总数:94
  • 评论总数:108
  • 引用总数:0
  • 浏览总数:2058
  • 留言总数:11
  • 当前主题:Scom主题
  • 当前样式:Scom

网站收藏

图标汇集

  • 本站支持WAP访问
  • 订阅本站的 ATOM 1.0 新闻聚合
  • 订阅本站的 RSS 2.0 新闻聚合