lect08 Strings and Input Failure

lect08 Strings and Input Failure - Strings Revisited string...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Strings Revisited string Is a Type in C++ Library <string> May Initialize or Assign with Double Quoted Values May Compare using Equality Operators Can Access Single Characters using Square Bracket Operator ([ ]) Can Use length() Object Function Can Add to String
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#include <iostream> #include <string> using namespace std; int main() { string lastname, firstname; cout << "Enter last name: "; cin >> lastname; cout << "Enter first name: "; cin >> firstname; cout << "Your name is " << firstname << " " << lastname << endl; return(0); }
Background image of page 2
#include <iostream> #include <string> using namespace std; int main() { string lastname, firstname; bool instructor; cout << "Enter last name: "; cin >> lastname; cout << "Enter Firstname: "; cin >> firstname; if (lastname == "hanrath") instructor = true; else instructor = false; return(0); }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#include <iostream> #include <string> using namespace std; int main() { string word = "start"; cout << word << endl; word[0] = 'h'; word[1] = 'e'; cout << word << endl; return(0); }
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 03/03/2010.

Page1 / 13

lect08 Strings and Input Failure - Strings Revisited string...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online