Lab 13-2/ Pg.506 #20, #21, #25/ Lab 14-2/ Pg.546 #19, #20

1 answer below »
Lab 13-2/ Pg.506 #20, #21, #25/ Lab 14-2/ Pg.546 #19, #20
Answered Same DayApr 11, 2021

Answer To: Lab 13-2/ Pg.506 #20, #21, #25/ Lab 14-2/ Pg.546 #19, #20

Aditi answered on Apr 20 2021
132 Votes
Solution/Ch13/Intermediate25.cpp
Solution/Ch13/Intermediate25.cpp
#include
#include
using namespace std;
int main(){
    string str;
    cout<<"Enter string: ";
    getline(cin, str);
    int n = str.length();       //find length


    for(int i=n-1; i>=0; i++){      //loop over from end to 0
        cout<    }
    return 0;
}
Solution/Ch13/Introductory20.cpp
Solution/Ch13/Introductory20.cpp
#include
#include
using namespace std;
int main(){
    while(true){
        string code;
        cout<<"Enter region code(Q to exit): ";
        cin>>code;

        if(code == "Q"){        //exit program
            return 0;
        }
        if(code.length() != 3){
            cout<<"\nRegion code must contain exactly 3 characters.";
        }
        else if(code[0] != 'A' && code[0] != 'B'){
            cout<<"\nFirst Character in region code must be either A or B.";
        }
        else if(code[1] < '0' || code[1] > '9' || code[2] < '0' || code[2] > 9){
            cout<<"\nSecond and third Character of region code must be numbers.";
        }
        else{
            if(code[0] == 'A'){
                cout<<"\nShipping Charges are $25";
            }
            else{
                cout<<"\nShipping Charges are $30";
            }
        }
    }

    return 0;
}
Solution/Ch13/Introductory21.cpp
Solution/Ch13/Introductory21.cpp
#include
#include
using namespace std;
int main(){

    string city, state, zip;
    cout<<"\nEnter city name: ";
    cin>>city;

    cout<<"\nEnter state name: ";
    cin>>state;

    cout<<"\nEnter ZIP code: ";
    cin>>zip;

    string output = city + ", " + state + "  " + zip;
    cout<
    return 0;
}
Solution/Ch13/Lab13-2.cpp
Solution/Ch13/Lab13-2.cpp
#include
#include
using namespace std;
int main(){
    string origWord = "";
    string letter = "";
    char dashReplaced = 'N';
    char gameOver = 'N';
    int numIncorrect = 0;
    string displayWord = "-----";

    //get original word
    while(origWord.length() != 5)
    {
        cout<<"Enter a 5-letter word in uppercase: ";
        getline(cin, origWord);
    }   //end while

    system("cls");      //clear the screen

    //start guessing
    cout<<"Guess this word: "<
    while(gameOver == 'N')
    {
        cout<<"Enter an uppercase letter: ";
        cin>>letter;

        //search for the letter in the original word
     ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here