#include <iostream>
#include <time.h>
#include <cstdlib>
#include <windows.h>
#include <algorithm>
#include <string>
using namespace std;
int liczba;
int*liczba_w;
*liczba_w=&liczba; //tu oznaczany jest blad
string agree; //odpowiedz
int liczba_prob=0;
int nie()
{
std::cout << "No to Pa, Pa" << endl;
system("pause");
exit(0);
}
int tak()
{
liczba_prob++;
std::cout << liczba_prob << ". Rzut odbedzie sie za: \n" << endl;
for(int i=3;i>=1;i--)
{
Sleep(1000);
std::cout << i << "\a" << endl;
}
system("cls");
srand(time(NULL));
*liczba_w=rand()%6+1;
std::cout << "Wylosowana liczba to " << *liczba_w << endl;
std::cout << "Czy chcesz losowac " << liczba_prob+1 << " raz ?" << endl;
std::cout << "\tTAK/NIE" << endl; std::cin >> agree;
transform(agree.begin(), agree.end(), agree.begin(), ::toupper);
system("cls");
if(agree=="TAK")
{
tak();
}
}
int main()
{
std::cout << "Witaj w symulatorze rzutu kostka !" << endl;
std::cout << "\nCzy chcesz wykonac pierwszy rzut ?" << endl;
std::cout << "\tTAK/NIE" << endl;
cin >> agree;
system("cls");
transform(agree.begin(), agree.end(), agree.begin(), ::toupper);
if(agree=="TAK")
{
tak();
}
if(agree=="NIE")
{
nie();
}
if((agree!="TAK")&&(agree!="NIE"))
{
do
{
std::cout << "\tNapisz TAK lub NIE" << endl;
cin >> agree;
system("cls");
transform(agree.begin(), agree.end(), agree.begin(), ::toupper);
if(agree=="TAK")
{
tak();
}
if(agree=="NIE")
{
nie();
}
}while((agree!="TAK")&&(agree!="NIE"));
}
}
Witam, chciałem zobaczyć jak działają wskaźniki w praktyce, jednakże kompilator Code::Blocks pokazuje następujący błąd w 12 linijce, który brzmi:
error: expected constructor, destructor, or type conversion before '=' token
Dziękuję z góry za odpowiedzi, poprosiłbym rówierz o małe wyjaśnienie skąd ten błąd się wziął. Pozdrawiam.