C語言實現第三版計算器

2021-10-11 02:46:29 字數 914 閱讀 4996

實現功能:實現數字的加減乘除,新增功能是包括小數計算

#include

#include

#include

void

lyl();

char w[

666]=""

;int length=

strlen

(h);

//測量字串長度

printf

("輸入的字串長度為:%d\n"

,length)

;//列印字串長度結果

int k=0;

int m=0;

for(

int i=

0;i)else}if

(!((h[i]

>=

'0'&& h[i]

<=

'9')

||(h[i]

=='.'))

)}printf

("\n");

printf

("參與的運算符號有:");

//列印字串長度結果

puts

(w);

//輸出字串,這裡輸出的是運算符號

printf

("\n");

float value=number[0]

;for

(int n=

0;n(w[n]

=='-')if

(w[n]

=='*')if

(w[n]

=='/')}

printf

("最終運算結果為:%f\n"

,value)

;//顯示運算結果

printf

("\n");

}int

main()

譚浩強C語言 第三版 習題9 3

題目描述 三角形面積 sqrt s s a s b s c 其中s a b c 2,a b c為三角形的三邊。定義兩個帶參的巨集,乙個用來求area,另乙個巨集用來求s。寫程式,在程式中用帶實參的巨集名來求面積area。輸入描述 a b c三角形的三條邊,可以是小數。輸出描述 三角形面積,保留3位小...

譚浩強C語言 第三版 習題11 5

題目描述 有n個學生,每個學生的資料報括學號 姓名 3門課的成績,從鍵盤輸入n個學生的資料,要求列印出3門課的總平均成績,以及最高分的學生的資料 包括學號 姓名 3門課成績 輸入描述 學生數量n佔一行每個學生的學號 姓名 三科成績佔一行,空格分開。輸出描述 各門課的平均成績 最高分的學生的資料 包括...

C語言實現計算器

同學,你好!附 c語言實現迷宮類小遊戲完整思路與 例項 design by 海上的雨 效果圖 完整 include include includevoid jingtailianbiao void dongtailianbiao int stu num define len sizeof struc...