实践2

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
int main()
{  char n;
 
  while(n!=EOF)
    {
	n=getchar();
	 getchar();
	
	switch(n)
    	{
		case 'y':printf("wait\n");break;
    	case 'g':printf("go go go\n");break;
    	case 'r':printf("stop\n");break;
    	default:printf("something must be wrong/n");   	}
		
}
      return 0;
}



#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{ 
   int n1,i,n2,flag=0;
   printf("那一天会是你的lucky day\n");
   printf("开始咯,有三次机会\n");
   scanf("%d",&n1);
   printf("\n");
   srand(time(0));
   n2=rand()%(30-1+1)+1;
    for(i=1;i<=2;i++)
      {  if(n1==n2)
         {printf("太棒啦猜中了!\n");break;
         flag=1;
		 }
	     if(n1>n2)
	      {printf("你猜的日期晚了\n");
	       scanf("%d",&n1);
		  }
		   if(n1<n2)
	      {printf("你猜的日期早了\n");
	       scanf("%d",&n1);
		  }
	  }
    if(flag==0)
      printf("三次机会都用完了呜呜呜\n");
 
  return 0;
}



#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{ 
  int l=1,h=1;
  while(h<10)
  {
  for(l;l<=h;l++)
 {
   printf("%d*%d=%d\t",l,h,l*h);}
   printf("\n");
  l=1;
  h++;}

  return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{ 
  int l=1,h=1,n;
  scanf("%d",&n);
  n=2*n; 
  while(h<n)
  {
  for(l;l<=h;l++)
 {
   printf("\t");}
  for(l;l<=n+1-h;l++)
 {
   printf(" o\t");}
   printf("\n");
  l=1;
 
  for(l;l<=h;l++)
 {
   printf("\t");}
  for(l;l<=n+1-h;l++)
 {
   printf("<H>\t");}
   printf("\n");
  l=1;
  for(l;l<=h;l++)
 {
   printf("\t");}
  for(l;l<=n+1-h;l++)
 {
   printf("I I\t");}
   printf("\n");
  l=1;
 
  h++;}

  return 0;
}

  

 

posted @ 2023-03-22 22:04  微笑王子  阅读(17)  评论(0编辑  收藏  举报