![]() |
補一點好了
前面提到 "scanf 會跟據指定的型態來轉換建盤輸入的資料" 所以來練習一下 程式如下 #include <iostream> #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { float num; int ch; float value; char todo; printf("Enter two number:"); scanf("%f %c %i",&num, &todo, &ch); switch(todo) { case '*': value=num * (float)ch; break; case '/': value=num/(float)ch; } printf("\n相除等於 %-6.2f",value); system("PAUSE"); return 0; } 當打上 17*5 時會得到 85.00 打上17/5 時會得到 3.40 |
所有時間均為台北時間。現在的時間是 08:30 PM。 |
Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2025, Jelsoft Enterprises Ltd.
『服務條款』
* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *