當前位置:首頁 » 編程語言 » 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

熱點內容
同等配置的聯想和戴爾哪個更好 發布:2025-07-02 09:02:33 瀏覽:123
華為如何查詢以前設置過的密碼 發布:2025-07-02 09:02:28 瀏覽:181
c語言地圖 發布:2025-07-02 09:00:14 瀏覽:488
計算機的主存儲器是指軟盤的容量 發布:2025-07-02 08:53:49 瀏覽:237
為什麼都說歐曼價格高配置低 發布:2025-07-02 08:53:00 瀏覽:547
300人用什麼電腦伺服器好 發布:2025-07-02 08:47:42 瀏覽:902
52好壓縮 發布:2025-07-02 08:24:16 瀏覽:246
javahttp發送http請求 發布:2025-07-02 08:17:05 瀏覽:226
美國編譯的青少經典書第三輯 發布:2025-07-02 08:16:59 瀏覽:949
阿里雲伺服器強制重啟 發布:2025-07-02 08:14:55 瀏覽:663