Hi I am writing a program that the inputs characters from another file and is supposed to output them to the screen. I am trying to make it so that the output of the first 4 numbers are the actual characters and not the ASCII code for those characters. Please help.
The file i am inputting from is a text file that contains:
1234
The program that is reading this text file is the following:
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
string file;
int SSN[4];
string firstname;
string lastname;
string major;
char charachter;
cout<<"type the name of the file containing your students records:"<<endl;
cin>>file;
ifstream fin;
fin.open(file.c_str());
if(fin.fail())
{
cout<<"There was an error trying to read the file you requested!"<<endl;
exit(1);
}
else
Why don't you just read the file into SSN from the beginning? If you want to make it an int, do so. I don't see the need for char character or a type conversion.