Z racji tego, że jestem tu nowy witam wszystkich na forum. Wracajac do wątku, mam problem z kodem poniżej:
#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;
class kalla
{
string AIname = "Kalla";
fstream file;
int chn = 140;
public:
string word,cutword[20],base[20],reply[20],line,sentence;
int n = 0,number = 0,nline;
void system(){
file.open("DataKalla.txt",ios::in | ios::out);
nline = 0;
Sleep(700);
if(file.good() == true){
while(!file.eof()){
getline(file,line);
base[nline] = line;
nline++;
cout<<"Base word file inf/: = good\n";
Sleep(20);
}
}
else{
cout<<"error read file system AI kalla!\n";
}
file.close();
cout<<endl;
Sleep(700);
file.open("ReplyDataBase.txt",ios::in | ios::out);
nline = 0;
cout<<endl<<"checking reply word...\n\n";
Sleep(700);
if(file.good() == true){
while(!file.eof()){
getline(file,line);
reply[nline] = line;
nline++;
cout<<"Reply word file inf/: = good\n";
Sleep(20);
}
}
else{
cout<<"error read file reply word!\n";
}
file.close();
read();
}
void read(){
while(true){
write();
cout<<"dziala\n";
n = 0;
for(int i = 0; i <= chn; i++){
cout<<"xd";
if(word[i] != '.'){
cutword[n] += word[i];
}
else{
n++;
}
}
number = 0;
while(number <= n){
sentence += cutword[number] + " ";
}
//system("cls");
cout<<"twoje zdanie: "<<sentence<<endl;
}
}
void write(){
cout<<"\nwpisz zdanie: ";
cin>>word;
cout<<endl;
}
};
int main()
{
kalla ob;
ob.system();
}
Niestety nie wiem co może być nie tak gdyż nie ma raczej żadnego błędu gdzie program mógłby się zatrzymać i nie wykonać dalszego kodu. Jeśli ktoś wie co jest nie tak prosiłbym o pomoc.