Üye
#ifndef _RDC_H_
#define _RDC_H_
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <Windows.h>
class RDC {
int Dice_1, Dice_2, sum;
int myPoint;
bool stat;
int balance, bet;
public:
RDC();
int RollDice();
void setBet(int);
int getBet()const;
int AddOrRem(int, bool);
void takeInfos();
enum Status{CONTINUE,WON,LOST}gameStatus;
~RDC();
};
#endif // !_RDC_H_
[CODE=cpp]
#include "RDC.h"
int main()
{
srand(static_cast<int>(time(0)));
RDC Usr;
Usr.takeInfos();
Usr.~RDC();
system("PAUSE");
return 0;
}
Problem c++ ile programlamaya giriş Paul&Harvey Deitel kitabında soruluyor. O yüzden üstüne düşmeden üstünkörü yaptım.Bu kategorimizde faydalı paylaşım yaptığınız için teşekkürler. Bunun daha da gelişmiş versiyonunu yapmak mümkün mü?
#include <iostream>
#include <random>
#include <ctime>
#include <iomanip>
int main(void)
{
std::default_random_engine CT(static_cast<unsigned int>(time(0)));
std::uniform_int_distribution<unsigned int> randomInt(1, 10);
do {
unsigned int sayi_1 = randomInt(CT);
unsigned int sayi_2 = randomInt(CT);
unsigned int cevap = 1;
std::cout << sayi_1 << "*" << sayi_2 << "=" << "Kactir ?" << std::endl;
std::cin >> cevap;
if (cevap != sayi_1 * sayi_2) {
std::cout << "Yanlis Cevap !" << std::endl;
std::cout << "Dogru Cevap = " << sayi_1 * sayi_2 << std::endl;
}
else {
std::cout << "Tebrikler dogru cevap !" << std::endl;
}
} while (true);
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?