當前位置:首頁 » 編程語言 » c語言結構體實例

c語言結構體實例

發布時間: 2024-12-12 21:55:40

A. C語言編程:定義一個汽車結構體

按照題目要求編寫的C語言汽車結構體程序如下

#include<stdio.h>

struct car{

float petrol;

}c1={0};

struct car refuel(struct car c){

c.petrol=c.petrol+2;

return c;

}

int main(){

int i;

for(i=0;i<5;i++){

c1=refuel(c1);

printf("%.2f ",c1.petrol);

}

return 0;

}

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:540
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:827
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:530
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:713
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:633
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:945
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:202
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:62
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:755
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:658