实验2

#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>int _tmain(int argc, _TCHAR* argv[])
{
   int a1, a2, a3;
   char c1, c2, c3;
   double x, y;scanf(" %d %d %d\n", &a1, &a2, &a3);
    getchar();
    printf("a1 = %d, a2 = %d, a3 = %d\n",a1, a2, a3);
    getchar();
    scanf("%c %c %c\n",&c1, &c2, &c3);
    getchar();
    printf("c1 = %c, c2 = %c, c3 = %c\n",c1, c2, c3);
    scanf(" %lf, %lf\n", &x, &y);
    getchar();
    printf("x = %lf, y = %lf\n", x, y);system("pause");
return 0;
}

 

 

#include"stdafx.h"
#include<stdlib.h>
#include<math.h>
#include<stdio.h>
   int_tmain(intargc, _TCHAR*argv[])
{
   doublex, ans;    
   scanf_s("%lf", &x);    
   ans= pow(x,365);    
   printf("%.2f的365次方:%.2f\n", x, ans);    
   system("pause");
   return0;
}

 

 

#include"stdafx.h"
#include<stdlib.h>
#include<math.h>
#include<stdio.h>
int_tmain(intargc, _TCHAR*argv[])
{doublex, ans;

    while(scanf_s("%lf", &x) !=EOF)   
    {       
       ans= pow(x,365);   
        printf("%.2f的365次方:%.2f\n", x, ans);
            printf("\n");   
    }   
             
              system("pause");
              return0;
}

 

 

#include"stdafx.h"
#include<stdlib.h>
#include<math.h>
#include<stdio.h>
int_tmain(intargc, _TCHAR*argv[])
{
doubleC, F;
while(scanf_s("%lf", &C) !=EOF)    
{
        F=( C*9/5+32);
            printf("摄氏度C = %.2f时,华氏度F = %.2f\n", C, F);   
             printf("\n");    
             }
                 system("pause");
                 return0;
}
#include"stdafx.h"
#include<stdlib.h>
#include<math.h>
#include<stdio.h>
int_tmain(intargc, _TCHAR*argv[])
{
chars;
while((s = getchar()) !=EOF)   
 {
 switch(s)       
  {
  case'y': printf("wait a minute\n");break;
  case'g': printf("go go go\n");break;
  case'r': printf("stop!\n");break;
  default:{ printf("somehing must be wrong...\n");
  }
  break;        
  }
      printf("\n");  
        } 
           system("pause");
           return0;
}
#include"stdafx.h"
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
int_tmain(intargc, _TCHAR*argv[])
{
inta, b, i;   
 srand( time(0));
     a= rand() %30+1;
         printf("猜猜2023年四月哪一天会是你的lucky day\n");
         for(i=1;i=3;++i)  
           { 
                  scanf("%d", &b);
                  if(a =b){   
                          printf("哇,猜中了:-)\n");
                          break;
        }
        else{if(a >b)       
        printf("你猜的日期早了,你的lucky day还没到呢\n");
        elseprintf("你猜的日期晚了,你的lucky day已经过啦\n"); 
                      }
                          }
        if(a =b)        getchar();
        elseprintf("次数用完啦,偷偷告诉你:四月你的lucky day是%d\n", a); 
        system("pause");
        return0;
}

 

#include"stdafx.h"
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
int_tmain(intargc, _TCHAR*argv[])
{
inti, n;
for(i=1;i<=9;i++)
{
for(n=1;n<=i;n++)   
       printf("%d x %d = %d", n, i, n*i);  
           printf("\n"); 
            }
                system("pause");
                return0;
}
#include"stdafx.h"
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
int_tmain(intargc, _TCHAR*argv[])
{
inti, n, a, t, v;
     scanf("%d", &a);
     for(i=a;i>=1;i--)
     {
              t= (2*i -1);
              for(v=a;v>i;v--)
                           printf("");
                           for(n=1;n<=t;n++)
                         printf("O  \t");            
                          printf("\n");for(v=a;v>i;v--)           
                            printf("");for(n=1;n<=t;n++)             
                            printf("<H> \t");             
                            printf("\n");for(v=a;v>i;v--)             
                            printf("");for(n=1;n<=t;n++)             
                            printf("I I \t");         
                            printf("\n");      
}
    system("pause");
    return0;
}

 

posted @ 2023-03-23 12:31  郑世成  阅读(17)  评论(0编辑  收藏  举报