Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
Add Comment
Please, Sign In to add comment