Write this programming assignment in C The directions are as
Write this programming assignment in C++! (The directions are as followed) You\'re a developer for a startup calledHowJStudythat matches study buddiesforclasses depending on the experience of eachuse In this lab you must: create a class called Userthat contains the following o name o classification o major o expert class list what classes the user feels they are an expert in o mutators and accessors for ead private variable o printUsers function that prints allthe users of the system o match StudBuddy fundion that matches users based on classes theyhavein common. (Meaning two or more classes that match) read a set of users from fileuserData.txt o read in a whole inefrom the file o parse the line you WI have to changethe delimiter of the getline statement to be comma delimited o Use this as and example EXAMPLE: I am writing a program that reads a comma-delimited file. There are several words on each line that will each be assigned to a string variable, each line in the file is a record, and the file contains several records am using getline with a delimiter, e.g. getline(inputstream, string, delimiter). The problem lam having is that this command reads through the newline, up until the next comma (my delimiter), so that where l should have two strings, l get one long string My code 1. wy input,eof0) hile 2. getline input, token, Do some stuff to the token string here For instance if the file contains Bob Saget Pimp Carrot Top Comedian. My getline command creates the following strings Bob, Saget PimpCarrot, Top, Comedian So essentially, how do I use the comma and the new ne character as delimiters for the same read function? 
Solution
Have a look at this piece of code on how getline works.
/*
* readFile.cpp
*
* Created on: 24-Nov-2016
* Author: kasturi
*/
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream infile(\"input.txt\");
string line;
//printing each line
while(getline(infile, line, \',\'))
{
cout<<line;
}
infile.close();
cout<<endl<<endl;
infile.open(\"input.txt\");
//printing each word
while(getline(infile, line, \',\'))
{
cout<<line<<endl;
}
infile.close();
}
My input was like this,
input.txt
Bob,Saget,Pimp
Carrot,Top,Comedian
OUTPUT:
BobSagetPimp
CarrotTopComedian
Bob
Saget
Pimp
Carrot
Top
Comedian

