Witam was. Mam pewien problem, z którym nie rada sobie poradzić. Najpierw Zachęcam do zerknięcia w kod.:
// Program Zgadywanka.cpp : Defines the entry point for the console application.
// Includes Start
#include <Windows.h>
#include <conio.h>
#include <vector>
#include <time.h>
#include <cstdio>
#include <cstdint>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <math.h>
//Includes end
// time definition
#define TIME = 60; //TIME = 60
bool clockgame();
using namespace std;//namespace declaration.
int main()//Funkcja główna
{ // main open.
Beep(50, 100); //1
Beep(50, 200); //2
Beep(50, 300); //3
Beep(50, 100); //1
Beep(50, 200); //2
Beep(50, 300); //3
Beep(50, 400); //4
Beep(50, 500); //5
cout<<" Chosse Spider "<<endl; // output
cout<<"You must chosse number, when time up, you lose."<<endl; // output
cout<<"Clock Start!"<<endl;
clockgame();
getch(); //"WAIT" for press any key.
return 0;//returns value 0
} // main close
bool clockgame() //second function
{ //bool open
srand(time(NULL));
int pozostalo = TIME; //this is a declaration of time.
int i = 18; //declatation of "I"
int chosse =(rand() %1000) + 1; //random "sECRET" Number.
do //while
{
pozostalo--; //Time deleting :)
pozostalo--; //Time deleting :D
pozostalo--; //Time deleting x)
pozostalo--; //Time deleting :D
pozostalo--; //Time deleting xD
pozostalo--; //Time deleting :)
pozostalo--; //Time deleting :D
pozostalo--; //Time deleting x)
pozostalo--; //Time deleting :D
pozostalo--; //Time deleting xD
cout<<"You have only"<<pozostalo<<"Seconds! \n"; //output
cout<<"Give me number :)"<<endl;
int zgaduj;
cin >> zgaduj;
if(zgaduj == chosse)
{
cout<<"Good! You retard"<<i<<"Points! \n";
ostream hajne;
hajne.open("score.dat" ios::binary | ios::in | ios::out);
int glue;
hajne >> glue;
int zapis = glue + i;
hajne << zapis;
cout<<"Very good!"<<endl;
}
if(zgaduj > chosse)
{
cout<<"Type smaller number!"<<endl;
}
if(zgaduj < chosse)
{
cout<<"Type bigger number!"<<endl;
}
}
while(pozostalo >= 1);
if(pozostalo = 0)
{
cout<<"You Lose..."<<"You lose"<<i<<"Points."<<endl;
ostream plik;//Files Stream
plik.open("score.dat" ios::binary | ios::in | ios::out); //Save Binary
int a;
plik >> a; //:O
if(a = 0) // "IF" a = 0
{
cout<<"You don't have points!"<<endl;
}
if(a > 0) // "IF" a > 0
{
cout<<"You have"<<a<<"Points,"<<"You lose"<<i<<"Points, and you have"<<a-i<<"Points."<<endl; //ostream
int begin = a - i; //save this :))
plik << begin; //they're don't cheat me!
time_t sekundy;
sekundy = time( NULL ); // time functions
plik << sekundy; //save the acctualy time to file.
}
}
return TRUE; //returns value TRUE
} //bool close
A teraz w logi:
template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)