سلام
امروز براتون سورس کد ماشین حساب به زبان سی پلاس رو گذاشتم ، امیدوارم مفید باشه.
<! --
#include <cstdlib> #include <iostream> using namespace std; int main() { double num; double num2; char choice; for (;;){ do { cout<<"Welcome to the Raysam.ir calculator. n"; cout<<"Please choose an option by entering the number, press q to quitn"; cout<<"1 - Additionn"; cout<<"2 - Subtractionn"; cout<<"3 - Divisionn"; cout<<"4 - Multiplicationn"; cout<<"5 - Helpn"; cout<<"6 - About This Programn"; cout<<"7 - Updates to this programn"; cin>>choice; } while ( choice < '1' || choice > '7' && choice != 'q'); if (choice == 'q') break; switch (choice) {
case '1': cout<<"Please enter a numbern"; cin>>num; cout<<"Another number to be addedn"; cin>>num2; cout<<num + num2; cout<<"n"; break; case '2': cout<<"Please enter a numbern"; cin>>num; cout<<"Another number to be subtractedn"; cin>>num2; cout<<num - num2; cout<<"n"; break; case '3': cout<<"Please enter a numbern"; cin>>num; cout<<"Another one to be dividedn"; cin>>num2; cout<<num / num2; cout<<"n"; break; case '4': cout<<"Please enter a numbern"; cin>>num; cout<<"Another one to be multipliedn"; cin>>num2; cout<<num * num2; cout<<"n"; break; case '5': cout<<"This is a simple calculator made by me - Josh.n"; cout<<"To select an option, type the number next to the option and press entern"; cout<<"E.G. for division, you would type 3 and press enter.n"; cout<<"n"; break; case '6': cout<<"the Raysam calculator, made by Raysam.ir - Copyright 2011. :)n"; cout<<"Feedback would be nice - Raysam.ir/forum also, what programmesn"; cout<<"do people need. Please give me ideas for programs. Bye!!n"; cout<<"n"; break; case '7': cout<<"Updates include: -double variable instead of int, so that decimals can be used.n"; cout<<" -do while loop so that you can exit the program yourselfn"; cout<<"n"; break; default: cout<<"That is not an option"; } } return 0;
} -->
|
دانلود فایل متنی کد