zoukankan      html  css  js  c++  java
  • Pointer_On_C (chapter 4部分习题)

      1 #include "stdio.h"
      2 #include "stdlib.h"
      3 
      4 /*int main(void)
      5 {
      6     char ch;
      7     
      8     ch=getchar();
      9     putchar(ch);
     10 }
     11 */
     12 
     13 /*int main(void)
     14 {
     15     int blank;
     16     int counter;
     17     
     18     scanf("%d",&blank);
     19     for(counter=0;counter<blank;counter++)
     20         putchar('
    '),printf("%d",counter+1);
     21 }
     22 */
     23 
     24 /*int main(void)
     25 {
     26     int leap_year;
     27     int year;
     28     
     29     scanf("%d",&year);
     30     
     31     if(year%400==0)
     32         leap_year=1;
     33     else if(year%100==0)
     34         leap_year=0;
     35     else if(year%4==0)
     36         leap_year=1;
     37     else
     38         leap_year=0;
     39     
     40     printf("%d",leap_year);
     41 }
     42 */
     43 
     44 /*int main(void)
     45 {
     46     int which_word;
     47     
     48     scanf("%d",&which_word);
     49     
     50     switch(which_word)
     51     {
     52         case 1:
     53         printf("who");
     54         break;
     55         
     56         case 2:
     57         printf("what");
     58         break;
     59         
     60         case 3:
     61         printf("when");
     62         break;
     63         
     64         case 4:
     65         printf("where");
     66         break;
     67         
     68         case 5:
     69         printf("why");
     70         break;
     71         
     72         default:
     73         printf("dont't know");
     74         break;
     75     }
     76 }
     77 */
     78 
     79 /*int main(void)
     80 {
     81     float sqrt_n;
     82     float guess;
     83     float preguess;
     84     
     85     scanf("%f",&sqrt_n);
     86     
     87     preguess=1.0;
     88     guess=1.0;
     89     do
     90     {
     91         preguess=guess;
     92         guess=(preguess+(sqrt_n/preguess))/2;
     93         printf("%f",guess);
     94         printf("
    ");
     95     }while(preguess!=guess);
     96 }
     97 */
     98 
     99 /*int main(void)
    100 {
    101     int n;
    102     int m;
    103     
    104     for(m=2;m<=100;m++)
    105     {
    106         for(n=2;n<m;n++)
    107         {
    108             if(m%n==0)
    109                 break;
    110         }
    111         
    112         if(n==m)
    113         {
    114             printf("%d",m);
    115             printf("
    ");
    116         }
    117     }
    118 }
    119 */
    120 
    121 /*int main(void)
    122 {
    123 printf( "1
    2
    " );
    124 for( number = 3; number <= 100; number = number + 2 ){
    125 for( divisor = 3; divisor < number; divisor = divisor + 2 ){
    126 if( number % divisor == 0 )
    127 break;
    128 }
    129 if( divisor >= number )
    130 printf( "%d
    ", number );
    131 }
    132 }
    133 */
    134 
    135 /*int main(void)
    136 {
    137     int a,b,c;
    138     int big;
    139     int sma;
    140     int mid;
    141     
    142     printf("please input three numbers(1,2,3)
    ");
    143     scanf("%d,%d,%d",&a,&b,&c);
    144     
    145     if(a>b)
    146         if(a>c)
    147         {
    148             big=a;
    149             
    150             if(b>c)
    151             {
    152                 mid=b;
    153                 sma=c;
    154             }
    155             else
    156             {
    157                 mid=c;
    158                 sma=b;
    159             }
    160         }
    161         else
    162         {
    163             big=c;
    164             mid=a;
    165             sma=b;
    166         }
    167     else
    168     {
    169         if(b>c)
    170         {
    171             big=b;
    172             
    173             if(a>c)
    174             {
    175                 mid=a;
    176                 sma=c;
    177             }
    178             else
    179             {
    180                 mid=c;
    181                 sma=a;
    182             }
    183         }
    184         else
    185         {
    186             big=c;
    187             mid=b;
    188             sma=a;
    189         }
    190     }
    191     
    192     if(mid+sma>big && big-mid<sma)
    193         if(mid==sma && sma==big)
    194             printf("Equilateral triangle
    ");
    195         else if(mid!=sma && mid!=big && sma!=big)
    196             printf("Inequilateral triangle
    ");
    197         else
    198             printf("Isosceles triangle
    ");
    199     else
    200         printf("Is not a triangle
    ");    
    201 }
    202 */
    203 
    204 /*int main(void)
    205 {
    206 float a;
    207 float b;
    208 float c;
    209 float temp;
    210 printf( "Enter the lengths of the three sides of the triangle: " );
    211 scanf( "%f %f %f", &a, &b, &c );
    212 if( a < b ){
    213 temp = a;
    214 a = b;
    215 b = temp;
    216 }
    217 if( a < c ){
    218 temp = a;
    219 a = c;
    220 c = temp;
    221 }
    222 if( b < c ){
    223 temp = b;
    224 b = c;
    225 c = temp;
    226 }
    227 if( c <= 0 || b + c < a )
    228 printf( "Not a triangle.
    " );
    229 else if( a == b && b == c )
    230 printf( "Equilateral.
    " );
    231 else if( a == b || b == c )
    232 printf( "Isosceles.
    " );
    233 else
    234 printf( "Scalene.
    " );
    235 return EXIT_SUCCESS;
    236 }
    237 */
    Yosoro
  • 相关阅读:
    Use MusicBrainz in iOS(三)查询专辑的完整信息
    内存寻址一(分段)
    POJ 1018 Communication System (动态规划)
    利用Eclipse中的Maven构建Web项目(二)
    cocos2d-x2.2.3学习
    (排序算法整理)NEFU 30/32
    POJ 1066 昂贵的聘礼
    2014年腾讯暑假实习软件开发笔试题汇总
    Android学习之——自己搭建Http框架(1)
    C 语言之预处理 ---------文件包括
  • 原文地址:https://www.cnblogs.com/tclan126/p/6384588.html
Copyright © 2011-2022 走看看