fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. string line("that cag moved");
  8. for(int a = 3; a < line.length(); a++)
  9. {
  10. if(line.at(a) == 'g')
  11. {
  12. cout << "Found a g at location " << a << '\n';
  13. }
  14. else
  15. {
  16. cout << line.at(a) << '\n';
  17. }
  18. }
  19.  
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
t
 
c
a
Found a g at location 7
 
m
o
v
e
d