So I'm trying to read a file into an INT array with no luck. I don't want to use a char array because I'm actually performing math operations. Any help would be GREATLY appreciated. I'll post the section I need.
And I know there's some conversion warnings, but those are the least of my worries. The text file is simply numbers with spaces, example:
37 181 201 89 64
And I know there's some conversion warnings, but those are the least of my worries. The text file is simply numbers with spaces, example:
37 181 201 89 64
Code:
int decrypt() {
ifstream in("encrypt.txt");
// Test to see if the file will open.
if(!in){
cout << "Cannot open file.";
return 1;
} //end if
int arr1[160];
int count1=1;
for(int g=0; g<count1; g++){ // Not sure what to do here?
in.getline(arr1[g], ' ');
}
in.close();
for(int k1 = 0; k1 < count1; k1++){
double m, m1;
m = arr1[k1];
m1 = pow (m,d);
double m2 = fmod(m1,n);
arr1[k1] = m2;
//cout << a[k] << endl;
} //end for
for(int ij=0; ij < count1; ij++){
cout << arr1[ij] << " ";
}
}; //end decrypt
Comment