Witam mam problem z programem bo gdzies mi się wysypuje i nie potrafie tego znaleŹć i poprawić, mógłby mi ktoś pomóc??
#include <iostream>
#include <conio.h>
using namespace std;
class PESEL {
public:
int NrPESEL[10];
int KontrolaPESEL[9];
char PodanyPESEL[10];
int W;
PESEL();
int ObliczSume();
void PobierzPESEL();
void SprawdzPESEL();
};
PESEL::PESEL()
{
KontrolaPESEL[0] = 1;
KontrolaPESEL[1] = 3;
KontrolaPESEL[2] = 7;
KontrolaPESEL[3] = 9;
KontrolaPESEL[4] = 1;
KontrolaPESEL[5] = 3;
KontrolaPESEL[6] = 7;
KontrolaPESEL[7] = 9;
KontrolaPESEL[8] = 1;
KontrolaPESEL[9] = 3;
};
int PESEL::ObliczSume()
{
int Suma = 0;
int i = 0;
while (i < 11) {
Suma = Suma + NrPESEL[i] * KontrolaPESEL[i];
cout << Suma << endl;
i++;
}
cout << "To bylo obliczenie" << endl;
return Suma % 10;
};
void PESEL::PobierzPESEL()
{
cout << "Podaj pesel" << endl;
cin >> PodanyPESEL;
};
void PESEL::SprawdzPESEL()
{
int a = 0;
while (a < 11) {
NrPESEL[a] = static_cast<int>(PodanyPESEL[a] - '0');
cout << NrPESEL[a] << endl;
a++;
}
cout << "To byl numer PESEL" << endl;
W = 10 - ObliczSume();
if (W == 10)
W = 0;
cout << W << endl;
if (NrPESEL[10] == W)
cout << "Pesel jest prawidlowy" << endl;
else
cout << "Pesel jest nieprawidlowy" << endl;
}
int main()
{
PESEL oPesel;
oPesel.PobierzPESEL();
oPesel.SprawdzPESEL();
_getch();
};