五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

C Primer Plus Test3

2019-12-25 20:12 作者:啷個里格朗郎郎  | 我要投稿

練習題來源:C Primer Plus (第6版)中文版

這章主要為數(shù)據(jù)的練習,基本數(shù)據(jù)類型都有涉及。

此為本人所寫,非最優(yōu)化。具體參考異步社區(qū)。

3.1

/*

編寫一個程序,要求提示輸入一個ASCII碼值,然后打印輸入的字符

*/

#include<stdio.h>

#include<stdlib.h>

int main(){


char ch;

printf("please input an ASCII:\n");

scanf("%d", &ch);

printf("%c\n",ch);

system("pause");

return 0;

}

3.2

/*

編寫一個程序,發(fā)出一聲警報,然后打印下面的文本

Startled by the sudden sond, Sally shouted,

"By the Great Pumkin, what was that!"?

*/

#include<stdio.h>

#include<stdlib.h>

int main(){

printf("\a");

printf("Startled by the sudden sond, Sally shouted,\n");

printf("\"By the Great Pumkin, what was that!\"\n");

system("pause");

return 0;

}

3.3

/*

讀取一個浮點數(shù),先打印成小數(shù)點形式,再打印出指數(shù)形式,

最后打印成p計數(shù)法(十六進制)。

Enter a floating-point values:64.25

fixed-point notation:64.250000

exponential notation:6.425000e+01

p notation: 0x1.01p+6?

*/

#include<stdio.h>

#include<stdlib.h>

int main(){


float f;

printf("Enter a floating-point values:");

scanf("%f",&f);

printf("fixed-point notation:%.6f\n",f);

printf("exponential notation:%e\n",f);

printf("p notation:%a\n",f);

system("pause");

return 0;

}?

3.4

/*

一年大約有3.156x10的7次秒,編寫一個程序,提示用戶輸入年齡,

顯示年齡該對應的秒數(shù)?

**/

#include<stdio.h>

#include<stdlib.h>

int main(){


double min = 3.156e7;

double m ;

int age;

printf("Enter your age:");

scanf("%d", &age);

m = age * min;

printf("the age is the same as %e", m);

system("pause");

return 0;

}

3.5

/*

一個水分子的質(zhì)量約為3.0x10的-23次克,一夸脫水大約是950克。

編寫一個程序,提示用戶輸入的水的夸脫數(shù),并顯示水分子的數(shù)量。?

*/

#include<stdio.h>

#include<stdlib.h>

int main(){


double w = 3e-23;

double kua = 950.0;

double num,number;

printf("Enter the kuatuo:");

scanf("%lf",&num);

number =(num *kua) / w;


printf("The water\'s fenzi number is %e",number);

system("pause");

return 0;

}?

3.6

/*

1英寸相當于2.54厘米。編寫一個程序,提示用戶輸入身高(英寸),

然后以厘米顯示身高。?

*/

#include<stdio.h>

#include<stdlib.h>

int main(){


float eq = 2.54;

float? tall, tall_limi;

printf("Enter your tall with yingcun:");

scanf("%f", &tall);

tall_limi = tall * eq;

printf("your tall is %f limi\n",tall_limi);

system("pause");

return 0;

}?

3.7

/*

在美國的體積測量系統(tǒng)中,1品脫等于2杯,一杯等于8盎司,

1盎司等于2大湯勺,1大湯勺等于3茶勺。

提示用戶輸入杯數(shù),并以品脫、盎司。湯勺。茶勺為單位進行輸出。?

*/

#include<stdio.h>

#include<stdlib.h>

int main(){


float angsi,tangshao,chashao,pintuo;

int cup;

printf("Enter cup number:");

scanf("%d", &cup);

pintuo = cup / 2;

angsi = cup * 8;

tangshao = angsi * 2;

chashao = tangshao * 3;?

printf("pintuo : %.1f\n", pintuo);

printf("angsi : %.1f\n", angsi);

printf("tangshao : %.1f\n", tangshao);

printf("chashao : %.1f\n", chashao);

system("pause");

return 0;

}


C Primer Plus Test3的評論 (共 條)

分享到微博請遵守國家法律
云南省| 孝昌县| 高雄市| 新巴尔虎左旗| 尼勒克县| 乌拉特中旗| 团风县| 彭泽县| 泰顺县| 芮城县| 榆中县| 灵山县| 巴彦县| 区。| 万年县| 大悟县| 宁陕县| 遂溪县| 方正县| 昌乐县| 和平区| 沅江市| 临西县| 平乐县| 和林格尔县| 高密市| 公安县| 华池县| 瓦房店市| 安阳县| 清水县| 牡丹江市| 新龙县| 昌平区| 云霄县| 天全县| 高雄县| 泰来县| 福安市| 仁化县| 鹤庆县|