c語言問題,求大佬幫忙,c語言問題,求大佬幫忙

2021-09-07 13:11:39 字數 2691 閱讀 9323

1樓:匿名使用者

#include "stdafx.h"

#include

#define sever_type 3

#define oil_type 4

int oil_type;

int serve_type;

double all_price;

struct oil

char *type;

double price;

struct serves

char *type;

double reduce;

oil oil[4]=,,,

,};serves serve[3]=,

,,};

void prinf_oil_message()

for(int i=0;iprintf("%s: **是%.2f \n",oil[i].type,oil[i].price);

for(int j=0;jprintf("%s: 優惠%.2f \n",serve[j].type,serve[j].reduce);

void choice_serve_oil(int ml,char s_type,int o_type)

int current_ml=ml;

switch(s_type)

case 'm'  :

serve_type=0;

break; /* 可選的 */

case 'e'  :

serve_type=1;

break; /* 可選的 */

/* 您可以有任意數量的 case 語句 */

default :

serve_type=2;

printf("error %s:pls input again\n",serve[serve_type].type);   /* 可選的/* 可選的 */break;

switch(o_type)

case 90  :

oil_type=0;

break; /* 可選的 */

case 93  :

oil_type=1;

break; /* 可選的 */

case 97  :

oil_type=2;

break; /* 可選的 */

/* 您可以有任意數量的 case 語句 */

default :

oil_type=3;

printf("error %s:pls input again\n",oil[oil_type].type);   /* 可選的

*/break;

all_price=current_ml*(1-serve[serve_type].reduce)*oil[oil_type].price;

printf("你的服務: %s,油: %s\n",serve[serve_type].type,oil[oil_type].type);

printf("總**為%.2f,welcome\n",all_price);

int main(int argc, char* ar**)

int weight_kg=0;

char seversult;

int oilresult=0;

prinf_oil_message();

printf("welcome oilstation,pls choice serves:\n");

while(true)

printf("pls input: 重量(kg),服務(m or e),油型(90,93,97)\n");

choice_serve_oil(weight_kg,seversult,oilresult);

return 0;

2樓:jw木有道理

int main()

if(c == 'm')

else if(c == 'e')

else

printf("%.2f\n",cost);

return 0;}

c語言問題 求大佬幫助

3樓:紫薇參星

按照題目要求編寫的使用do-while語句列印水仙花數的c語言程式如下

#include

int main()

while(x<=999);

return 0;}

c語言問題怎麼做?求大佬幫寫**

4樓:瘋狂小鳥

#include

main()

{   int t,l[10],c[10],i,j,k,m;

while(1){

scanf("%d",&t);

for(i=0;i

如圖所示,望採納。。。。。。

程式設計問題,求大佬幫忙

5樓:aaa軟體教育

如果有心從事程式設計方向的工作,最好到專業機構深入學習、多實踐,更貼近市場,這樣更有利於將來的發展。建議考慮時下火爆的python,python不僅入門簡單,靈活高效。更是在人工智慧方面應用廣泛,對將來大有裨益

C語言問題C語言問題,C語言問題C語言問題

include include int main b k p b k 0 puts b return 0 c語言問題c語言問題 include int main int h,m scanf d d h,m printf s num h if m 0 else printf o clock print...

C語言問題,C語言問題C語言問題

這題考的是自動型別轉換,由編譯系統自動完成,轉換是 向上 靠的 舉個例子 include stdio.h void main 你編譯一下就會有警告 conversion from double to float possible loss of data 也就是說系統預設轉化了a,b的資料型別為do...

C語言,幫忙看看哪裡出了問題,C語言問題幫忙看看問題出在哪裡?

doa i j 1 a i j while j 2 a i 0 a i 2 你寫的這個什麼意思呢 它實際上的意思是j 2時 執行a i j 1 a i j 但你的意思可能是j 2時 執行a i 0 a i 2 這是你對do while 不瞭解造成的 再去學習下額然後你寫的思路也不對 你那樣是達不到那...