Shows the effect of the preceding statements

Assignment Help C/C++ Programming
Reference no: EM13339789

The following program shows the effect of the preceding statements.
//Example string operations
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name = "William Jacob"; //Line 1
string str1, str2, str3, str4; //Line 2
cout << "Line 3: Name = " << name << endl; //Line 3
str1 = "Hello There"; //Line 4
cout << "Line 5: str1 = " << str1 << endl; //Line 5
str2 = str1; //Line 6
cout << "Line 7: str2 = " << str2 << endl; //Line 7
str1 = "Sunny"; //Line 8
str2 = str1 + " Day"; //Line 9
cout << "Line 10: str2 = " << str2 << endl; //Line 10
str1 = "Hello"; //Line 11
str2 = "There"; //Line 12
str3 = str1 + " " + str2; //Line 13
cout << "Line 14: str3 = " << str3 << endl; //Line 14
str3 = str1 + " " + str2; //Line 15
cout << "Line 16: str3 = " << str3 << endl; //Line 16
str1 = str1 + " Mickey"; //Line 17
cout << "Line 18: str1 = " << str1 << endl; //Line 18
str1 = "Hello there"; //Line 19
cout << "Line 20: str1[6 ] = " << str1[6 ]
<< endl; //Line 20
str1[6] = "T"; //Line 21
cout << "Line 22: str1 = " << str1 << endl; //Line 22
//String input operations
cout << "Line 23: Enter a string with "
<< "no blanks: "; //Line 23
cin >> str1; //Line 24
char ch; //Line 25
cin.get(ch); //Read the newline character; Line 26
cout << endl; //Line 27
cout << "Line 28: The string you entered = "
<< str1 << endl; //Line 28
cout << "Line 29: Enter a sentence: "; //Line 29
getline(cin, str2); //Line 30
cout << endl; //Line 31
cout << "Line 32: The sentence is: " << str2
<< endl; //Line 32
return 0;
}

Reference no: EM13339789

Questions Cloud

State whether the following are valid switch statements : State whether the following are valid switch statements. If not, explain why. Assume that n and digit are int variables.
Calculate the wavelength of the interfering waves : Two sinusoidal waves traveling in opposite directions interfere to produce a standing wave with the wave function y = (1.00) sin(0.800x) cos(300t), Determine the wavelength of the interfering waves
What are the operating risks of the company : What are the operating risks of the company and what is the financial risk of the company (the debt to total capitalization ratio)?
What is the range of wavelengths of this sound in air : Bats emit a wide variety of sounds, one type emits pulses of sound having a frequency between 39kHz and 78kHz. What is the range of wavelengths of this sound in air
Shows the effect of the preceding statements : The following program shows the effect of the preceding statements.
Compute the unit target cost per calculator : Calcutron Company is contemplating introducing a new type of calculator to complement its existing line of scientific calculators.
Assume there is no foreign trade and the economy : Assume there is no foreign trade and the economy is in equilibrium. If actual investment is greater than desired investment then it is most likely that?
Determine how fast must the particle be traveling : A particle of mass m0 is given a kinetic energy equal to one-fourth its rest-mass energy. How fast must the particle be traveling
Write a program that will input the name of five students : Write clearly with documentations where necessary as you write the program to solve the following problem.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd