How do you skip over sentances in file input

Ok so I want to read in a file that says this

Please enter the name of the family purchasing the home:Howard
Please enter the home's price:250000.00
Please enter the down payment percentage:.10
Please enter the interest rate as a percentage:.0524


But how can I skip over the please enter the stuff and just get right to the main information that's useful to my program, because if I try to read in this file wont Please get stored first into my string variable Any help on this would be great.



Here is the beginning to my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <fstream>


using namespace std;

int main()
{
	const string FAMILY_NAME;
	const int HOME_PRICE;
	const int DOWN_PAYMENT;
	const float INTEREST_RATE;
	ifstream morgageInfo;

	morgageInfo.open("MorgageInfo.txt");

	morgageInfo >> FAMILY_NAME 
The academic solution is to read a line at a time, search for the colon, then the
remainder of the line is the input.
http://cplusplus.com/reference/string/getline/ to read in an entire line

http://cplusplus.com/reference/string/string/find/ or http://cplusplus.com/reference/string/string/rfind/ to find the colon.

http://cplusplus.com/reference/string/string/substr/ to parse out the portion you want.

http://cplusplus.com/reference/iostream/stringstream/ to convert the parsed string to the appropriate datetype.

Also, you've declared all your variables as const. You can't modify const variables once they've been declared.
I think I kinda miss lead you guys, im reading in from a file not from the keyboard and when I try to read in a string it stops at the white space like it should. I want to read in the whole line (from the file) so I can search for the colon and "crop" out the info I need

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//Patrick Howard

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <fstream>


using namespace std;

int main()
{
	//string str;
	string familyName;
	/*
	const int HOME_PRICE;
	const int DOWN_PAYMENT;
	const float INTEREST_RATE;
	*/

	ifstream morgageInfo;

	morgageInfo.open("C://Users//Patrick//Documents//CProjects//MorgageInfo.txt");

	morgageInfo >> familyName;

	cout << familyName << endl;

	morgageInfo.close();
	return 0;
}
Topic archived. No new replies allowed.