Chapter10 - Dr. Serdar Kirli 1 Chapter 10 Strings String...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Dr. Serdar Kirli 1 Chapter 10 Strings String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)" ; string color1 = "red" ; string color2 = "blue" ; string color3 = "gold" ; int start = car.find( "(" ) + 1 ; int end = car.find( ")" ); int length = end - start; string color = car.substr(start, length); if (color == "red" ){ cout<<endl<< "This is a <<color1<< car!" ; } if (color != color2){ cout << endl << "I do not like this car!" ; } cout << endl; system( "PAUSE" ); return ; } String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)" ; string color1 = "red" ; string color2 = "blue" ; string color3 = "gold" ; int start = car.find( "(" ) + 1 ; int end = car.find( ")" ); int length = end - start; string color = car.substr(start, length); car String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)" ; string color1 = "red" ; string color2 = "blue" ; string color3 = "gold" ; int start = car.find( "(" ) + 1 ; int end = car.find( ")" ); int length = end - start; string color = car.substr(start, length); car color1 String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)" ; string color1 = "red" ; string color2 = "blue" ; string color3 = "gold" ; int start = car.find( "(" ) + 1 ; int end = car.find( ")" ); int length = end - start; string color = car.substr(start, length); car color1 color2 String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)" ; string color1 = "red" ; string color2 = "blue" ; string color3 = "gold" ; int start = car.find( "(" ) + 1 ; int end = car.find( ")" ); int length = end - start; string color = car.substr(start, length); car color1 color2 color3 String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)" ; string color1 = "red" ; string color2 = "blue" ; string color3 = "gold" ; int start = car.find( "(" ) + 1 ; int end = car.find( ")" ); int length = end - start; string color = car.substr(start, length); car color1 color2 color3 0 12 String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)" ; string color1 = "red" ; string color2 = "blue" ; string color3 = "gold" ; int start = car.find( "(" ) + 1 ; int end = car.find( ")" ); int length = end - start; string color = car.substr(start, length); car color1 color2 color3 start 0 12 String Object Example 1 #include <iostream> #include <cstdlib> #include <string> using namespace std; int main( void ){ string car = "72 Mustang, (red)"...
View Full Document

Page1 / 128

Chapter10 - Dr. Serdar Kirli 1 Chapter 10 Strings String...

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

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