I am writing a program that calculates and prints parking charges i am using get.line for the user to enter, how do i use "find" to separate the line?
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
int main ()
{
string enter_date;
string enter_time;
string exit_date;
string exit_time;
int calculatecharge;
int num;
cout << "Please enter the date and time the car is entering "<< endl
<< "the parking garage in the following format: YY/MM/DD hh:mm"<< endl;
getline (cin,enter_date);
getline (cin,enter_time);
cout<< "Please enter the date and time the car is exiting "<< endl
<< "the parking garage in the following format: YY/MM/DD hh:mm"<< endl;
getline (cin,exit_date);
getline (cin,exit_time);
find(' ')
cout<<"Parking fee due: "<< num << endl;
return 0;
}
If you are using getline() twice, try the below code.
getline (cin, enter_date, ' ');
getline (cin, enter_time);