Hello so I have this program that for now does nothing that keeps ignores the cin.get(code,7); , terminates procces and now it even crashes when it gets there.
#include <iostream>
#include <string.h>
usingnamespace std;
int main()
{
char p[8],code[10],txt[1000];
longlongint sum=1,cod=1;
int expl,i;
cout<<"Welcome to CryptSec 1.0 created by Andu\nEnter the acces password (7 letters): ";
cin.get(p,8);
for(i=0;i<=5;i++)
sum*=int(p[i]);
sum/=int(p[6]);
if(sum==12076374870)
{
cout<<"\nACCES GRANTED";cin.get();cin.get();cout<<"\nContinue 1\nInstructions 2\n";
cin>>expl;
if(expl==2)
cout<<"\nThis program encrypts and decrypts text using a 5 letters code you enter.\nThe text can only be decrypted with the code it was encrypted with.";
cin.get();
cout<<"\n\nEncrypt 1\nDecrypt 2\n";
cin>>expl;
if(expl==1)
{
cout<<"\n\nEncrypting:\nEnter the 5 letters code: ";
cin.get(code,7); //!!!!!!!! HERE IT CRASHES AND IGNORES THIS cin.get
for(i=0;i<=4;i++)
cod*=int(code[i]);
cod/=int(code[5]);
cod/=int(code[6]);
}
if(expl==2)
{
cout<<"\n\nDecrypting:\nEnter the 5 letters code: ";
}
}
else
cout<<"\nACCESS DENIED";
return 0;
}
Can anyone figure out what i did wrong. thank you all in advance.