首页 > 其他分享 >实验2

实验2

时间:2023-03-23 12:46:07浏览次数:38  
标签:stdafx int scanf TCHAR 实验 printf include

#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;
}

 

标签:stdafx,int,scanf,TCHAR,实验,printf,include
From: https://www.cnblogs.com/63385404abcd/p/17247040.html

相关文章

  • 实验二
    #include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){ intnumber; inti; srand(time(0)); f......
  • 实验二
    实验任务1task1.c源代码#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;int......
  • 实验二
    #task1#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;inti;sran......
  • 实验2
    任务1#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;inti;sr......
  • 实验二
    task1#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;inti;s......
  • 实验2
    实验任务1程序源码#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;int......
  • 实验2 字符串和列表
    task1x='nbaFIFA'print(x.upper())print(x.lower())print(x.swapcase())print()x='abc'print(x.center(10,'*'))print(x.ljust(10,'*'))print(x.rjust(10,'*'))......
  • 实验2
    实验任务1#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;inti;sr......
  • 实验2
    task1(1)line18代码实现的功能是:一个586到781间的随机数(2)该程序的功能为随机生成586到781之间的"真·随机数"task2//.2.2.c.cpp:定义控制台应用程序的入......