forked from buckyroberts/Source-Code-from-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request buckyroberts#67 from Collins-a/master
71_cppBeginners.cpp
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <iostream> | ||
#include <string.h> //gives you the string functions | ||
|
||
using namespace std; | ||
|
||
int main(int argc, const char *argv[]){ | ||
|
||
// string bucky; | ||
// cin >> bucky; //only reads upto the first whitespace | ||
// cout <<"The string I entered is " << bucky << endl; | ||
|
||
// string x; | ||
// getline(cin,x); //gets the whole line form input | ||
// cout << x << endl; | ||
|
||
// string s1("hampster "); //creating string with constructor | ||
// string s2; | ||
// string s3; | ||
// | ||
// s2=s1; | ||
// s3.assign(s2); | ||
// | ||
// cout << s1 << s2 << s3 << endl; | ||
|
||
string s1 = "omgwtfbbq"; | ||
cout << s1.at(3) << endl; | ||
|
||
for(int x=0;x<s1.length();x++){ | ||
cout << s1.at(x); | ||
} | ||
|
||
return 0; | ||
} |