Senin öğrendiğin C++ ile ancak "Hello World!" yazan programlar yapabilirsin.
Komut satırı üzerinde çalışan ve en az dört işlemi sürekli yapabilen ve kapat komutu girilmeden sonlanmayan bir hesap makinesi yapmayı dene. Ne kadar C++ bildiğine kendin bir kanaat getir. Bunu beceremezsen, hiç bir şey öğrenememişsin.
[CODE lang="cpp" title="Hesap Makinesi.cpp"]#include <iostream>
#include <clocale>
using namespace std;
int main()
{
setlocale(LC_ALL, "Turkish");
float x, y;
char secenek;
char secenek2;
do
{
cout << "Hangi işlemi yapmak istiyorsunuz?" << endl << "(Toplama = A)" << endl << "(Çıkarma = B)" << endl << "(Çarpma =C)" << endl << "(Bölme = D)" << endl;
cin >> secenek2;
if ((secenek2 == 'A') || (secenek2 == 'a'))
{
cout << "1. Sayıyı Giriniz: ";
cin >> x;
cout << "2. Sayıyı giriniz: ";
cin >> y;
cout << x << "+" << y << "= " << x + y << endl;
cout << "Hesap makinesini tekrar kullanmak ister msisiniz? (E/H)" << endl;
cin >> secenek;
}
else if ((secenek2 == 'B') || (secenek2 == 'b'))
{
cout << "1. Sayıyı Giriniz: ";
cin >> x;
cout << "2. Sayıyı giriniz: ";
cin >> y;
cout << x << "-" << y << "= " << x - y << endl;
cout << "Hesap makinesini tekrar kullanmak ister msisiniz? (E/H)" << endl;
cin >> secenek;
}
else if ((secenek2 == 'C') || (secenek2 == 'c'))
{
cout << "1. Sayıyı Giriniz: ";
cin >> x;
cout << "2. Sayıyı giriniz: ";
cin >> y;
cout << x << "X" << y << "= " << x * y << endl;
cout << "Hesap makinesini tekrar kullanmak ister msisiniz? (E/H)" << endl;
cin >> secenek;
}
else if ((secenek2 == 'D') || (secenek2 == 'd'))
{
cout << "1. Sayıyı Giriniz: ";
cin >> x;
cout << "2. Sayıyı giriniz: ";
cin >> y;
cout << x << "/" << y << "= " << x / y << endl;
cout << "Hesap makinesini tekrar kullanmak ister msisiniz? (E/H)" << endl;
cin >> secenek;
}
else
{
cout << "Böyle bir seçenek yok " << endl;
cout << "Hesap makinesini tekrar kullanmak ister msisiniz? (E/H)" << endl;
cin >> secenek;
}
}
while ((secenek == 'E') || (secenek == 'e'));
return 0;
}[/CODE]
Evet, yapabiliyorum.