weather.cpp

来自「在c环境下的对数据结构进行讲解,包含有例题及答案」· C++ 代码 · 共 28 行

CPP
28
字号
 //weather.cpp
 #include <iostream.h>
 #include <conio.h>
 #include <stdlib.h>				//randomize(),random
 void main()
 { int weather;
   cout << "天气(0,1)=";			//0:好,1:雨
   cin >> weather;
   if (weather)					//weather==1
   { cout << "看电影去,多少钱?";
     int money;
     cin >> money;
     if (money>=1000)
     cout << "钱够\n";
     else
     cout << "钱不够\n";
   } else
   { cout <<"郊游去,交通工具(0,1)=";	//0:公车 1:自行车
     int tool;
     cin >> tool;
     if (tool)
     cout << "骑自行车\n";
     else
     cout <<"搭公车\n";
   }
   getch();
 }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?