I am doing my work but suddenly while reading data from file, i suddenly faced text in other form i also carried a small test to check whether is it my code fault or Visual Studio 2012 gone mad. I also debug but values in "line[]" coming correct. But i found small test is still giving me same thing: here is my small code test:
file: input.txt
{
value := (rate * dollar) + (rate1 * dollar1);
totalvalue := value / 2;
t1 = ivariable > 10 && ivariable < 100
{
value := (rate * dollar) + (rate1 * dollar1);
totalvalue := value / 2;
}
}
code:
#include <sstream>
#include <fstream>
using namespace std;
void main(){
const int si = 1500;
string line[si];
ifstream infile;
infile.open("input.txt");
cout<<"Reading"<<endl;
// infile>>data;
// cout<<data<<endl;
int a=0;
int size=0;
// string line[1500];
// for (int i=0;i<10;i++){
while(!infile.eof()){
getline(infile,line[a],'\n');
cout<<line[a]<<endl;
a++;
}
}
and the output:
Any idea please share......
Looks like you have copied down some text from pdf either from Adobe or Nitro and pasted in notepad as a .txt. Never do such thing always try to either by write your self or use Notepad editor. I also faced such thing while doing compiler. My teacher gave me inputs in pdf file and i copied. Sorry for late reply i was reading Light comments and me a laugh that he such you.... Good Luck!
Your input.txt
is encoded in Unicode, but your console is not set to render Unicode.
Save your file as plain ASCII.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With