本来挺简单的一个程序,但突然想把《Friends》给糅合进去,就多花了一些心思,这是我写过最有趣的程序了。

#include <stdio.h>
#include <stdlib.h>
#include <time.h> int getrand()
{
srand(time(NULL));
return rand()%3;
} int win_lose(int choice)
{
int rand = 0;
char *p[3] = {"SCISSORS", "STONE", "CLOTH"};
rand = getrand();
printf("\nThe system give the %s.\n",p[rand]);
rand++; if(choice == rand) //even
{
printf("\nJoey:\tHei, How you doing? We call it even, all right?\n");
printf("\tAnd if you are Chandler M. Bing, of course you will say ok.\n");
return 0;
}
else if(rand==choice-1 || rand==choice+2) //win
{
printf("\nMonica:\tOf course the winner is Me. I knew it, you such a loser,\n");
printf("\tyou can't win me ever!\n");
printf("Ross:\tIt can't be, I am Profess Geller and I am a doctor.\n");
printf("\tI can't lose, you must cheat me last time. \n");
return 1;
}
else //lose
{
printf("\nRachel:\tOh my god! Oh my god! I can't believe this. Phoebe,\n");
printf("\tyou are my best friend, can we forget this?\n");
printf("Phoebe:\tOk, But it is when you say that you don't love Ross any more.\n");
return -1;
}
} int main()
{
int choice = 0;
int flag = 0;
int rot = 0;
char ch;
system("clear");
printf("***********************************************");
printf("\n\tLets play a game about <Friends>.\n");
printf("***********************************************");
printf("\nJanice:\tYou don't want to see me any more, right? \n\tSo just chose a number quickly:\n");
printf("\n1.SCISSORS\n2.STONE\n3.CLOTH\n");
do
{
printf("\nInput your choice:");
scanf("%d",&choice);
if(choice>0 && choice<4)
{
flag = win_lose(choice);
while((ch=getchar())!='\n' && ch!=EOF);
printf("\nGunther:I want to see Rachel");
if(flag == -1)
printf(" again");
printf(", so please replay it.(y/n)");
}
else
{
while((ch=getchar())!='\n' && ch!=EOF);
printf("\nMonica:\tWhat's the matter with you! What you need is just chose\n");
printf("\ta number from 1 to 3. So are you ready?(y/n)");
} ch = getchar();
}
while(ch=='y' || ch=='Y' || ch=='\n'); printf("\nGoodbye!\n"); return 0;
}

谨以此程序纪念下《Friends》,Monica、Ross、Joey、Rachel、Chandler、Phoebe。

还请诸位大侠自动忽略那蹩脚的英语。

最新文章

  1. 数据结构图文解析之:AVL树详解及C++模板实现
  2. sql转db,后台坑货
  3. mysql mHA manager 状态修改
  4. Encrypt
  5. 【Gym 100971K】Palindromization
  6. mysql的Replication机制
  7. (原)android中的动画(三)之动画监听&amp;页面切换动画
  8. ios开发中如何实现软件版本更新
  9. Android自定义控件(三)——有弹性的ListView
  10. dwz分页实现分析
  11. maxContainerCapability 设置不足
  12. doubango(3)--协议栈的启动过程
  13. 使用MvcPager实现Ajax分页
  14. CMDB-实例
  15. 设计模式のTemplatePattern(模板模式)----行为模式
  16. DSO论文解读
  17. SharpGL学习笔记(四) 正射投影
  18. 如何使用tapd?
  19. STS 设置 注解提示
  20. Asp.Net Session的三种方法及Web.Config设置

热门文章

  1. iOS js oc相互调用(JavaScriptCore)---js调用iOS --js里面通过对象调用方法
  2. TP框架的增删改
  3. Python小练习(持续更新....)
  4. php的json_encode不兼容JSON_UNESCAPED_UNICODE
  5. netbeans无法新建项目
  6. JS异错面试题
  7. 教你管理SQL数据库系列(1-4)
  8. 高性能javascript学习总结(1)--加载与运行
  9. vim 真是上瘾啊
  10. linux FAQ(zz)