fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. string HighScoreInfo1 = "Chrystel 00:09";
  6. string previous_name = "Chrystel";
  7. int test = previous_name.size() + 1;
  8. string TimeToBeat = HighScoreInfo1.substr(test, 5);
  9. cout << "Orginal string size " << ">>" << HighScoreInfo1.size() << " " << "size of name"<< ">>" <<previous_name.size()+2<<" " << "Position "<< test << endl;
  10. cout << "Orginal string " << ">>"<<HighScoreInfo1 << " " << "Substring"<< ">>" <<TimeToBeat << endl;
  11.  
  12. HighScoreInfo1 = "Don 00:09";
  13. previous_name = "Don";
  14. test = previous_name.size() + 1;
  15. TimeToBeat = HighScoreInfo1.substr(test, 5);
  16. cout << "Orginal string size " << ">>" << HighScoreInfo1.size() << " " << "size of name"<< ">>" <<previous_name.size()+2<<" " << "Position "<< test << endl;
  17. cout << "Orginal string " << ">>"<<HighScoreInfo1 << " " << "Substring"<< ">>" <<TimeToBeat << endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Orginal string size >>14 size of name>>10 Position 9
Orginal string >>Chrystel 00:09 Substring>>00:09
Orginal string size >>9 size of name>>5 Position 4
Orginal string >>Don 00:09 Substring>>00:09