Please do not post links to read in writing into a file tutorials here. I already read them, and did not find an answer.
I wrote a program that reads values for Rate and L from a file. However i do not know how to properly write the file for reading-in in the first place, and it gives me an infinite loop.
Here is the file content:
Rate= 0.25;
L=540;
Rate = 0
Here is the program code:
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
ifstream infile("coolfile.dat");
double Rate, L, N, Payment;
then I'd recommend reading each line into a string, using the getline() function.
Then either use a stringstream to parse the data, or use the string functions to find the '=' sign, and split the string accordingly into subtrings. If you use the latter option, you may still need to convert the string into a number, for example using strtod().
The stringstream approach is probably easier.