當前位置:首頁 » 編程語言 » c語言入門經典習題答案

c語言入門經典習題答案

發布時間: 2022-03-07 20:19:17

A. 有關《c語言入門經典(第4版)》習題

#include<stdio.h>

int main()
{
int year, month, day;
char *m[] = {" ", "January", "February", "Marth", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

printf("請輸入月 日 年:\n");
scanf("%d %d %d", &month, &day, &year);

printf("%dst %s %d\n", day, m[month], year);

return 0;
}
運行通過哈~~當然,沒有寫判斷日是否超過21,月是否超過12的代碼哈~~
示例:
請輸入月 日 年:
12 31 2003
31st December 2003

B. 求C語言入門練習題和答案

只有題目我現在也沒答案

C. 一個C語言入門經典的習題,有沒有會的給看看,多謝

你的代碼沒有問題 我試過了,再怎麼舍入也不會從7到54的。。。 而且你用的是int 不會有那種情況。。。

D. 《C語言入門經典》(第四版)怎麼下答案

http://www.tupwk.com.cn/downpage/search.asp

E. c語言入學經典第五版第五章節答案

是c語言入門經典吧
這里有下載:
http://..com/link?url=_
請採納

F. C語言入門經典 習題5.3問題 答案如下

1、 定義父類:Shape(形狀)類,Shape只有一個屬性color,並有相應的getColor和setColor方法。 2、 Shape類有兩個子類:Rectangle(矩形)類和Circle(圓形)類,子類繼承了父類的color屬性和getColor、setColor方法。 3、 為兩個子類增加相應的屬性和getArea方法

//Shape(父類)
public class Shape{
public String color;
public void getColor(){
}
public void setColor(){
}
}
//子類(Rectangle)
public class Rectangle extends Shape {
//添加屬性
public double getArea(double X,double Y){//X:長 Y:寬
double temp=X*Y;
return temp;
}
}
//子類(Circle)
public class Circle extends Shape {
//添加屬性
double dou=3.14;
public double getArea(double Y){//Y:半徑
double temp=dou*Y*Y;//公式忘了 ,自己拼
return temp;
}
}

G. C語言入門經典(第5版)2.16練習的答案!

/*Exercise2.*/

/**/
/*fortheprocttype..*/
#include<stdio.h>

intmain(void)
{
doubletotal_price=0.0;/*Totalprice*/
inttype=0;/*Procttype*/
intquantity=0;/*Quantityordered*/
constdoubletype1_price=3.50;
constdoubletype2_price=5.50;

/*Gettheprocttype*/
printf("Enterthetype(1or2):");
scanf("%d",&type);

/*Gettheorderquantity*/
printf("Enterthequantity:");
scanf("%d",&quantity);

/*Calculatethetotalprice*/
total_price=quantity*(type1_price+(type-1)*(type2_price-type1_price));

/*Outputthearea*/
printf("Thepricefor%doftype%dis$%.2f ",quantity,type,total_price);
return0;
}
//////////////////////////////////////////////////////////////////////////////////
/*Exercise2.*/
#include<stdio.h>

intmain(void)
{
doublepay=0.0;/*Weeklypayindollars*/
doublehours=0.0;/*hoursworked*/
intdollars=0;/*Hourlyrate-dollars*/
intcents=0;/*...andcents*/

/*GettheWeeklypay*/
printf("Enteryourweeklypayindollars:");
scanf("%lf",&pay);

/*Gettheorderquantity*/
printf("Enterthehoursworked:");
scanf("%lf",&hours);

/*Calculatetheaveragehourlyrate-dollarsfirst*/
dollars=(int)(pay/hours);

/**/
/*andmultiplyby100togetcents.Ifwethenadd0.5andconverttheresult*/
/*backtoaninteger,itwillbetothenearestcent.*/
cents=(int)(100.0*(pay/hours-dollars)+0.5);

/*Outputtheaveragehourlyrate*/
printf("Youraveragehourlypayrateis%ddollarsand%dcents. ",dollars,cents);
return0;
}

H. 求編寫一程序!本人在學C語言,看的是霍頓的《C語言入門經典》,請哪位達人告知哪有此書課後習題電子版答

#include<stdio.h>
void main()
{
int month,year,date;
char *strmon[12]={"january","februrary","march","april","may","june","july","august","september","october","november","december"};
scanf("%d、%d、%d",&month,&date,&year);

switch(date%10)
{
case 1:
{
printf("%dst %s %d",date,strmon[month-1],year);
break;
}
case 2:
{
printf("%dnd %s %d",date,strmon[month-1],year);
break;
}
case 3:
{
printf("%drd %s %d",date,strmon[month-1],year);
break;
}
default:
{
printf("%dth %s %d",date,strmon[month-1],year);
}
}
}
編譯已通過!至於你的那本書,我就不知道咯!

I. C語言入門經典第5版習題12.1

不是多餘的,當新開辟的空間不是接在buffer後面的時候,那麼沒有這一句取出來的值會出現錯誤,這一句是為了讓取值指向新開辟的空間

J. c語言入門經典(第五版)

http://www.apress.com/9781430248811
http://kuai.xunlei.com/d/BaTCAjz5rpmQUwQA8df

熱點內容
安卓開發選哪個版本的SDK 發布:2025-07-02 22:19:07 瀏覽:485
未上傳圖片 發布:2025-07-02 22:14:01 瀏覽:598
安卓qq直播怎麼分享聲音 發布:2025-07-02 22:13:21 瀏覽:249
安卓系統怎麼刷機清除內存 發布:2025-07-02 22:08:19 瀏覽:696
安卓手機6位數密碼有多少組 發布:2025-07-02 21:50:31 瀏覽:797
存儲卡視頻多了 發布:2025-07-02 21:49:40 瀏覽:850
ajax無刷新上傳圖片 發布:2025-07-02 21:32:56 瀏覽:117
編譯器不認pow函數 發布:2025-07-02 21:27:04 瀏覽:339
w10隱藏文件夾 發布:2025-07-02 21:27:03 瀏覽:534
電腦d盤拒絕訪問 發布:2025-07-02 21:27:02 瀏覽:779