ENGR 101 Lecture 18: 18LectureNotes-2

28 views7 pages
24 Jan 2017
School
Department
Course

Document Summary

So far we have considered problems where the data we are manipulating is primarily numbers. Often the data we want to work with is not number, but rather text. Strings provide a way of manipulating text objects to use strings you must include them by putting an include line at the top of your c++ program: Declaring a string to declare a string: string firstname; to assign a value to a string string firstname( peter ); string firstname= peter ; or. You could do the same thing in two steps string firstname; firstname = peter ; You can add strings together string firstname( peter ); string lastname( parker ); string fullname, occupation; full name = firstname + + lastname; occupation = superhero ; You can send strings to files and standard output using << cout << name: << fullname << endl; cout << job: << occupation << endl; Note, however that upper and lowercase letters are considered different.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents