-
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.
- Loading branch information
1 parent
baee8ba
commit 6987373
Showing
9 changed files
with
131 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,10 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() | ||
{ | ||
cout << "Hello world!" << endl; | ||
|
||
return 0; | ||
} |
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,21 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() | ||
{ | ||
char ch; | ||
cin.get(ch); | ||
|
||
int ct = 0; | ||
while(ch != '\n') | ||
{ | ||
cout << ch; | ||
ct++; | ||
cin.get(ch); | ||
} | ||
|
||
cout << ct << endl; | ||
|
||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
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,21 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
const int Limit = 255; | ||
|
||
int main() | ||
{ | ||
char input[Limit]; | ||
|
||
cout << "Enter a string for getline() processing: " << endl; | ||
cin.getline(input, Limit, '#'); | ||
cout << "Here is your input: " << endl; | ||
cout << input << endl; | ||
cout << "---------------------------" << endl; | ||
|
||
char ch; | ||
cin.get(ch); | ||
cout << ch << endl; | ||
return 0; | ||
} |
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,49 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main() | ||
{ | ||
char ch; | ||
|
||
while (cin.get(ch)) | ||
{ | ||
if (ch != '#') | ||
cout << ch; | ||
else | ||
{ | ||
cin.putback(ch); | ||
break; | ||
} | ||
} | ||
|
||
cout << endl; | ||
|
||
if (!cin.eof()) | ||
{ | ||
cin.get(ch); | ||
cout << ch << " is next input character." << endl | ||
} | ||
else | ||
{ | ||
cout << "End of input reached." << endl; | ||
exit(0); | ||
} | ||
|
||
while (cin.peek() != '#') | ||
{ | ||
cin.get(ch); | ||
cout << ch; | ||
} | ||
|
||
if (!cin.eof()) | ||
{ | ||
cin.get(ch); | ||
cout << endl | ||
<< ch << " is next input character." << endl; | ||
} | ||
else | ||
cout << "End of file reached." << endl; | ||
|
||
return 0; | ||
} |
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 @@ | ||
Hello world! |
Binary file not shown.
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,29 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
const int SLEN = 10; | ||
|
||
int main() | ||
{ | ||
char name[SLEN]; | ||
char title[SLEN]; | ||
|
||
cout << "Enter your name: "; | ||
cin.get(name, SLEN); | ||
|
||
if(cin.peek() != '\n') | ||
cout << "Sorry, we don't have enough room for " << name << endl; | ||
|
||
while(cin.get() != '\n') | ||
continue; | ||
|
||
cout << "Dear " << name <<", enter your title: "; | ||
cin.get(title, SLEN); | ||
if(cin.peek() != '\n') | ||
cout << "We were forced to truncate your title." << endl; | ||
cout << "Name: " << name << endl; | ||
cout << "Title: " << title << endl; | ||
|
||
return 0; | ||
} |