Skip to content

Instantly share code, notes, and snippets.

@christianc1
Created September 21, 2015 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianc1/d32f8e1828d740d450c9 to your computer and use it in GitHub Desktop.
Save christianc1/d32f8e1828d740d450c9 to your computer and use it in GitHub Desktop.
Buddy's Homework 9/20
// Buddy's Homework
#include <iostream>
#include <string>
using namespace std;
int main() {
// Init variable
string passCode;
// Set variable
passCode = "1 "
// Standard for loop
for( string::iterator i = passCode.begin(); i != passCode.end(); ++i ) {
// if this iteration is == to ' ' (a space)
if( *i == ' ' ) {
// Set this iteration = to an underscore
*i = '_';
}
}
// output the new passcode
cout << passCode << endl;
// return 0
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment