Last active
November 23, 2017 13:04
-
-
Save Bojne/72da9d28c11fc865f1483ea4ffd94964 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
string user_input; | |
string regis_year, campus, course, faculty; | |
void display(string regis_year,string campus,string course, string faculty); | |
int main(){ | |
cout << "Please enter your registration number below and press enrer.\n"; | |
cin >> user_input; | |
int end_index = user_input.find('/',0); | |
faculty = user_input.substr(0,end_index); | |
int beg_index = end_index;//Store beg_index to end_index | |
end_index = user_input.find('/',end_index+1);//Iterate end_index | |
course = user_input.substr(beg_index+1,end_index-beg_index-1); | |
beg_index = end_index; | |
end_index = user_input.find('/',end_index+1); | |
campus = user_input.substr(beg_index+1,end_index-beg_index-1); | |
regis_year = user_input.substr(user_input.find(".")+1,-1); | |
//cout << beg_index<<endl; | |
//cout << end_index<<endl; | |
//cout << faculty << endl; | |
//cout << regis_year<< endl; | |
//cout << campus << endl; | |
//find | |
//sybstr | |
display(regis_year, campus,course,faculty); | |
return 0; | |
} | |
void display(string regis_year,string campus,string course, string faculty){ | |
cout << endl<< "Registrered_year: "<<regis_year<<endl; | |
cout << "Campus: " << campus << endl; | |
cout << "Course: " << course << endl; | |
cout << "Faculty: " << faculty << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment