C++ loading from txt files prob
I wrote this code (pasted below) i'm a complete noob when i try to load it though it comes up with a bunch of funny characters in place of where it is supposed to show the value of bfile. I want this line here cout<< str <<"\n"; to show the value of variable no1 which has been saved into a text file earlier in the program. Instead it shows up with 3 asc11 symbols. Why is it doing this how do i fix it?
Code:
#include <iostream.h>
#include <fstream.h>
void main()
{
char str;
int no1, no2;
cout<<"Please enter the first number: ";
cin>> no1;
cout<<"Please enter the second number: ";
cin>> no2;
cout<<"number 1 added to number 2 = "<< no1-no2 <<"\n";
ofstream a_file ( "add_calc.txt" );
a_file<< no1 ;
cout<< "numbers input were: ";
ifstream b_file ( "add_calc.txt" );
b_file>> str;
cout<< str <<"\n";
cin.get();
cin.get();
}