file handling :'(

GUYS!!!
I need help!!!!

this code is thought to give me the string i enter with spaces ...instead it give a insane number....!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 #include<iostream>
#include<fstream>
using namespace std;
int main()
{
	ofstream ob1;
	string a,b;
	ob1.open("chck.txt");
    getline(cin,a);
	ob1<<a<<endl;
	cin.sync();
	ob1.close();
	ifstream bo("chck.txt");
    while(bo>>a)   {
    	
		cout<<getline(bo,a);
	}
	system("pause");
	
}
you dont need getline in line 16
Topic archived. No new replies allowed.