Guest User

Untitled

a guest
Nov 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string user_input;
  6. string regis_year, campus, course, faculty;
  7. void display(string regis_year,string campus,string course, string faculty);
  8.  
  9. int main(){
  10. cout << "Please enter your registration number below and press enrer.\n";
  11. cin >> user_input;
  12. int end_index = user_input.find('/',0);
  13. faculty = user_input.substr(0,end_index);
  14. int beg_index = end_index;//Store beg_index to end_index
  15. end_index = user_input.find('/',end_index+1);//Iterate end_index
  16. course = user_input.substr(beg_index+1,end_index-beg_index-1);
  17. beg_index = end_index;
  18. end_index = user_input.find('/',end_index+1);
  19. campus = user_input.substr(beg_index+1,end_index-beg_index-1);
  20. regis_year = user_input.substr(user_input.find(".")+1,-1);
  21. //cout << beg_index<<endl;
  22. //cout << end_index<<endl;
  23. //cout << faculty << endl;
  24. //cout << regis_year<< endl;
  25. //cout << campus << endl;
  26. //find
  27. //sybstr
  28.  
  29. display(regis_year, campus,course,faculty);
  30. return 0;
  31.  
  32.  
  33.  
  34. }
  35.  
  36. void display(string regis_year,string campus,string course, string faculty){
  37. cout << endl<< "Registrered_year: "<<regis_year<<endl;
  38. cout << "Campus: " << campus << endl;
  39. cout << "Course: " << course << endl;
  40. cout << "Faculty: " << faculty << endl;
  41. }
Add Comment
Please, Sign In to add comment