Skip to content

Instantly share code, notes, and snippets.

@cjoshmartin
Created December 7, 2017 23:14
Show Gist options
  • Save cjoshmartin/9f2e9142af7ad929ce75cf906a82539f to your computer and use it in GitHub Desktop.
Save cjoshmartin/9f2e9142af7ad929ce75cf906a82539f to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
std::cout << "Hello, World!" << std::endl;
string input;
string output="";
cout<< endl;
int i=0;
while(getline(cin, input)) // will store the the current line from user input into `input` string
{
size_t split = input.find(","); // finds the location of the first space
int numberOfTimes = stoi(input.substr(0,split)); // using the space will store the first half as the 'membername'.
//cout << numberOfTimes<< endl;
string restOfString = input.substr(split+1,input.length());
size_t splitSpace =restOfString.find(" ");
string songNote = restOfString.substr(0,splitSpace);
//cout << endl;
//for(int i=0; i< numberOfTimes;i++) {
//output +=
if(i++ <1)
{
cout << endl;
}
cout<< songNote + ",";
// }
//cout <<"\n"<< output << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment