设为首页收藏本站

如鹏网

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
楼主: 杨中科

《C语言也能干大事》第一节

[复制链接]

0

主题

0

好友

1

积分

新手上路

Rank: 1

发表于 2011-11-2 22:28:27 |显示全部楼层
为什么不让我在去年发现如鹏网? 努力学习中!

0

主题

0

好友

28

积分

新手上路

Rank: 1

发表于 2011-11-6 13:10:56 |显示全部楼层
  1. #include "stdafx.h"

  2. int APIENTRY WinMain(HINSTANCE hInstance,
  3.                      HINSTANCE hPrevInstance,
  4.                      LPSTR     lpCmdLine,
  5.                      int       nCmdShow)
  6. {
  7.         // TODO: Place code here.
  8.         int reg = MessageBox(NULL,TEXT("你是好人吗?"),TEXT("真心话"),MB_YESNO|MB_ICONQUESTION);
  9.         if(reg==IDYES)
  10.         {
  11.                 MessageBox(NULL,TEXT("你看你就不像好人,点击【确定】开始格式化C盘!"),TEXT("真心话"),MB_OK|MB_ICONHAND);
  12.         }
  13.         else
  14.         {
  15.                 MessageBox(NULL,TEXT("尝试把你变成好人失败,是否重试?"),TEXT("真心话"),MB_RETRYCANCEL);
  16.         }
  17.         return 0;
  18. }
复制代码

0

主题

0

好友

28

积分

新手上路

Rank: 1

发表于 2011-11-6 13:11:55 |显示全部楼层

0

主题

0

好友

14

积分

新手上路

Rank: 1

发表于 2011-11-19 20:00:20 |显示全部楼层
交作业:
#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
        // TODO: Place code here.
   int ret0,ret1=MessageBox(NULL,TEXT("你是好人吗?"),TEXT("人品鉴定"),MB_YESNO|MB_ICONQUESTION);
          if(IDYES==ret1)
          {
             MessageBox(NULL,TEXT("看你就不是好人!点确定开始格式化C盘"),TEXT("鄙视你"),MB_OK|MB_ICONERROR);

          }
          else
          {
         ret0=MessageBox(NULL,TEXT("试图把你变成好人失败"),TEXT("挽救"),MB_RETRYCANCEL|MB_ICONHAND);
             for(ret0;IDRETRY==ret0;)
                 {
                    ret0=MessageBox(NULL,TEXT("坏人就是坏人,无法变成好人"),TEXT("没戏啦"),MB_RETRYCANCEL|MB_ICONHAND);
                 }
          }
        return 0;
}

1

主题

0

好友

140

积分

注册会员

Rank: 2

发表于 2011-11-27 13:14:51 |显示全部楼层
回复 50# mhjerry


    当时好有想象力!写的搞笑的。
默默奋斗ING

0

主题

0

好友

22

积分

新手上路

Rank: 1

发表于 2011-12-6 01:56:05 |显示全部楼层
全角逗号的问题“,”→“,”

0

主题

0

好友

1

积分

新手上路

Rank: 1

发表于 2011-12-17 16:20:47 |显示全部楼层
我做的作业!
#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
        // TODO: Place code here.
    int ret = MessageBox(NULL,TEXT("你是好人吗?"),TEXT("询问"),MB_YESNO|MB_ICONQUESTION);
        if (ret==IDYES)
        {
                MessageBox(NULL,TEXT("一看你就不像好人!点【确定】开始格式化C盘"),TEXT("哈哈"),MB_OK|MB_ICONEXCLAMATION);
        }
        else
        {
            MessageBox(NULL,TEXT("尝试把你变成好人失败,是否重试?"),TEXT("哈哈"),MB_RETRYCANCEL|MB_ICONHAND);
        }
        return 0;
}

0

主题

0

好友

205

积分

中级会员

Rank: 3Rank: 3

发表于 2011-12-30 12:38:21 |显示全部楼层
交作业!!以后每天晚上给女友发这个。。。呵呵




// test1.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
        // TODO: Place code here.
        int res=MessageBox(NULL,TEXT("你今天又不老实了吧?"),TEXT("提示"),MB_YESNO|MB_ICONQUESTION);
       
        if(IDYES==res)
                MessageBox(NULL,TEXT("哎,我一猜就是!老实交代吧!"),TEXT("提示"),MB_OK|MB_ICONEXCLAMATION);
        else
                MessageBox(NULL,TEXT("我怎么就那么不信呢!你再好好想想吧!"),TEXT("提示"),MB_OK|MB_ICONEXCLAMATION);

        return 0;
}

0

主题

0

好友

12

积分

新手上路

Rank: 1

发表于 2011-12-30 21:23:58 |显示全部楼层

0

主题

0

好友

92

积分

注册会员

Rank: 2

发表于 2012-1-16 12:01:20 |显示全部楼层
我也加入如鹏了   我的第一个作业
// zuoye.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
  // TODO: Place code here.
int a=MessageBox(NULL,TEXT("你是好人吗?"),TEXT("提问"),MB_YESNO|MB_ICONQUESTION);
if(IDYES==a)
{
  MessageBox(NULL,TEXT("一看你就不像好人,点击【确定】开始格式化C 盘!"),
   TEXT("回复"),MB_OK|MB_ICONEXCLAMATION);
}
else
{
  do
  {
  a=MessageBox(NULL,TEXT("尝试把你变成好人失败,是否重试?"),TEXT("提问"),MB_RETRYCANCEL);
  }
  while(IDRETRY==a);
}
return 0;
}

0

主题

0

好友

2

积分

新手上路

Rank: 1

发表于 2012-1-16 15:17:42 |显示全部楼层
来交作业....
  1. // 1恶搞程序.cpp : Defines the entry point for the application.
  2. //

  3. #include "stdafx.h"

  4. int APIENTRY WinMain(HINSTANCE hInstance,
  5.                      HINSTANCE hPrevInstance,
  6.                      LPSTR     lpCmdLine,
  7.                      int       nCmdShow)
  8. {
  9.         int i=MessageBox(NULL,TEXT("你是好人吗?"),TEXT("质询"),MB_YESNO|MB_ICONQUESTION);
  10.         if(IDYES==i)
  11.         {
  12.                 MessageBox(NULL,TEXT("你看你就不像好人,点击【确定】开始格式化C盘!"),TEXT("格式化"),MB_OK|MB_ICONWARNING);
  13.         }
  14.         else
  15.         {
  16.                 MessageBox(NULL,TEXT("试把你变成好人失败,是否重试?"),TEXT("失败"),MB_RETRYCANCEL);
  17.         }
  18.         return 0;
  19. }


复制代码

就不截图了

0

主题

0

好友

13

积分

新手上路

Rank: 1

发表于 2012-1-18 20:49:44 |显示全部楼层
偶来虚心学习下   辛苦了 谢谢分享。

1

主题

0

好友

154

积分

注册会员

Rank: 2

发表于 2012-1-18 21:12:38 |显示全部楼层
希望一起学习技术

0

主题

0

好友

1

积分

新手上路

Rank: 1

发表于 2012-1-18 21:52:47 |显示全部楼层
交个作业
// tset0.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
        // TODO: Place code here.
        int flag=1;
        while(flag)
        {
                int ret=MessageBox(NULL,TEXT("你是好人吗?"),TEXT("提问"),MB_YESNO|MB_ICONQUESTION);
                if(IDYES==ret)
                {
                        MessageBox(NULL,TEXT("你看起来就不象好人,点击确定开始格式化C盘"),TEXT("警告"),MB_OK|MB_ICONEXCLAMATION);
                        MessageBox(NULL,TEXT("开始格式化C盘"),TEXT("LOADING"),MB_OK);
                        flag=0;
                }
                else
                {
                        int ret1=MessageBox(NULL,TEXT("尝试把你变成好人"),TEXT("回复"),MB_RETRYCANCEL);
                                if(IDRETRY==ret1)
                                {
                                        flag=1;
                                }
                                else
                                {
                                        flag=0;
                                }
                }
               
        }
        return 0;
}

0

主题

0

好友

34

积分

新手上路

Rank: 1

发表于 2012-2-2 22:06:58 |显示全部楼层
  1. #include "stdafx.h"

  2. int APIENTRY WinMain(HINSTANCE hInstance,
  3. HINSTANCE hPrevInstance,
  4. LPSTR lpCmdLine,
  5. int nCmdShow)
  6. {
  7. // TODO: Place code here.
  8. int ref;
  9. do
  10. {
  11. ref = MessageBox(NULL,TEXT("你是好人吗?"),TEXT("询问"),MB_YESNO|MB_ICONQUESTION );
  12. if(IDYES==ref)
  13. {
  14. MessageBox(NULL,TEXT("你看你就不像好人,点击【确定】开始格式化C盘!"),TEXT("提示"),MB_ICONEXCLAMATION);
  15. }
  16. else
  17. {
  18. ref = MessageBox(NULL,TEXT("尝试把你变成好人失败,是否重试?"),TEXT("提示"),MB_RETRYCANCEL|MB_ICONASTERISK);
  19. }
  20. }while(IDRETRY == ref);
  21. return 0;
  22. }
复制代码

1

主题

0

好友

82

积分

注册会员

Rank: 2

发表于 2012-2-10 16:23:46 |显示全部楼层
来好好学习下  C语言也能干大事 了

0

主题

0

好友

2

积分

新手上路

Rank: 1

发表于 2012-2-11 19:06:43 |显示全部楼层

0

主题

0

好友

62

积分

注册会员

Rank: 2

发表于 2012-2-14 19:04:46 |显示全部楼层

0

主题

0

好友

1

积分

新手上路

Rank: 1

发表于 2012-2-17 03:13:43 |显示全部楼层

0

主题

0

好友

1

积分

新手上路

Rank: 1

发表于 2012-2-18 14:33:40 |显示全部楼层
同为八零后,差距怎么这么大啊

0

主题

0

好友

12

积分

新手上路

Rank: 1

发表于 2012-3-10 22:20:13 |显示全部楼层
那个位运算设置的太好了

0

主题

0

好友

1

积分

新手上路

Rank: 1

发表于 2012-3-15 08:20:51 |显示全部楼层

0

主题

0

好友

11

积分

新手上路

Rank: 1

发表于 2012-3-18 13:57:45 |显示全部楼层
虽然看得比较迟,但是课讲的非常好

0

主题

0

好友

22

积分

新手上路

Rank: 1

发表于 2012-3-21 14:52:57 |显示全部楼层
老师你好!我原先写的是
int ret=MessageBox(NULL,TEXT("你是人吗"),TEXT("问候"),MB_YESNO|MB_ICONQUESTION);
               
        if(ret==IDYES)
        {
               
        MessageBox(NULL,TEXT("你看你就不像好人,点击【确定】开始格式化C盘!"),TEXT("问候"),MB_YES);
       
        }

        else
        {

    MessageBox(NULL,TEXT("尝试把你变成好人失败,是否重试?"),TEXT("问候"),MB_NO);
然后编译器里面无法运行,之后我把TEXT("问候"),MB_YES|MB_ICONQUESTION和
MB_NO|MB_ICONQUESTION);
里的yes和no改成ok就可以运行了,可是原因是什么我不懂,有大师可以解释一下吗?

0

主题

0

好友

12

积分

新手上路

Rank: 1

发表于 2012-3-23 19:38:53 |显示全部楼层

0

主题

0

好友

42

积分

新手上路

Rank: 1

发表于 2012-3-29 15:58:56 |显示全部楼层
迟来的学生,谢谢杨老师
  1. #include "stdafx.h"

  2. int APIENTRY WinMain(HINSTANCE hInstance,
  3.                      HINSTANCE hPrevInstance,
  4.                      LPSTR     lpCmdLine,
  5.                      int       nCmdShow)
  6. {
  7.         // TODO: Place code here.
  8.         int ret = MessageBox(NULL,TEXT("Are you a good person?"),TEXT("Ask"),MB_YESNO|MB_ICONQUESTION);
  9.         if (ret == IDYES)
  10.         {
  11.                 MessageBox(NULL,TEXT("I think you not good, check OK to format c:"),TEXT("Warning"),MB_OK|MB_ICONWARNING);
  12.         }
  13.         else
  14.         {
  15.                 while(true)
  16.                 {
  17.                         MessageBox(NULL,TEXT("Failed to change you into a good person, do it again?"),TEXT("Ask"),MB_RETRYCANCEL);
  18.                 }
  19.         }
  20.         return 0;
  21. }
复制代码

0

主题

0

好友

42

积分

新手上路

Rank: 1

发表于 2012-3-29 15:59:08 |显示全部楼层
迟来的学生,谢谢杨老师
  1. #include "stdafx.h"

  2. int APIENTRY WinMain(HINSTANCE hInstance,
  3.                      HINSTANCE hPrevInstance,
  4.                      LPSTR     lpCmdLine,
  5.                      int       nCmdShow)
  6. {
  7.         // TODO: Place code here.
  8.         int ret = MessageBox(NULL,TEXT("Are you a good person?"),TEXT("Ask"),MB_YESNO|MB_ICONQUESTION);
  9.         if (ret == IDYES)
  10.         {
  11.                 MessageBox(NULL,TEXT("I think you not good, check OK to format c:"),TEXT("Warning"),MB_OK|MB_ICONWARNING);
  12.         }
  13.         else
  14.         {
  15.                 while(true)
  16.                 {
  17.                         MessageBox(NULL,TEXT("Failed to change you into a good person, do it again?"),TEXT("Ask"),MB_RETRYCANCEL);
  18.                 }
  19.         }
  20.         return 0;
  21. }
复制代码

1

主题

0

好友

116

积分

注册会员

Rank: 2

发表于 2012-3-30 22:47:18 |显示全部楼层
开始系统的学习了,加油!!

0

主题

0

好友

2

积分

新手上路

Rank: 1

发表于 2012-4-1 03:47:24 |显示全部楼层
第一节的内容不是很难,还算学得懂。

0

主题

0

好友

2

积分

新手上路

Rank: 1

发表于 2012-4-2 01:07:28 |显示全部楼层
// test1.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
        // TODO: Place code here.
        MessageBox(NULL,TEXT("你好"),TEXT("世界你好"),MB_OK);
        return 0;
}
您需要登录后才可以回帖 登录 | 注册

手机版|Archiver|如鹏网 ( 粤ICP备09013919号 )   360网站安全检测平台

GMT+8, 2012-5-19 16:18

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部