Pointer_On_C (chapter 4部分习题)
Posted lan126
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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(‘\n‘),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("\n"); 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("\n"); 116 } 117 } 118 } 119 */ 120 121 /*int main(void) 122 { 123 printf( "1\n2\n" ); 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\n", 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)\n"); 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\n"); 195 else if(mid!=sma && mid!=big && sma!=big) 196 printf("Inequilateral triangle\n"); 197 else 198 printf("Isosceles triangle\n"); 199 else 200 printf("Is not a triangle\n"); 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.\n" ); 229 else if( a == b && b == c ) 230 printf( "Equilateral.\n" ); 231 else if( a == b || b == c ) 232 printf( "Isosceles.\n" ); 233 else 234 printf( "Scalene.\n" ); 235 return EXIT_SUCCESS; 236 } 237 */
以上是关于Pointer_On_C (chapter 4部分习题)的主要内容,如果未能解决你的问题,请参考以下文章
深入理解计算机系统_3e 第四章家庭作业(部分) CS:APP3e chapter 4 homework
JavaWeb chapter 4 Servlet处理HTTP请求
零元学Expression Blend 4 - Chapter 38 看如何使用Clip修出想要的完美曲线(下)
零元学Expression Blend 4 - Chapter 35 讨厌!!我不想一直重复设定!!『Template Binding』使用前後的差异