
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:AutoSave
Lab06 - Last saved by user -
O Search
ff
Dagmawi Ganoro
DG
File
Home
Insert
Draw
Design
Layout
References
Mailings
Review
View
Help
A Share
P Comments
X Cut
- A A Aa v
E-E E E AL T
AaBbCcD AaBbCcDd AaBbCcDd AaBbC AaBbCcC AaBbCcD AaB
Find
Courier New
v 10
LE Copy
. Replace
Paste
BIU v ab x, x A - ev A v
Code
1 Normal
1 No Spac. Heading 1 Heading 2
Heading 3
Dictate
Editor
Title
Format Painter
A Select v
Clipboard
Font
Paragraph
Styles
Editing
Voice
Editor
// Due: UCLODEI 42, Z038
//
#include <iostream>
using namespace std;
int main()
char ansi
int num;
// Initialization
cout <« endl « "Do you want to add a number? (y / n)" <« endl;
sin >> ansi
while ((ans ==
{
'y') || (ans == 'Y'))
sout << "Enter number to be added: "
cin >> num;
Sout <« "The addition of "
<« endl;
<< num << " is "
<« num + num << endl;
// Update
cout <« endl « "Do you want to add another number? (y/n)" << endl;
sin >> ansi
}
return 0;
}
1.Modify the program to change the || to &&. What is the result? Why? Change it back after you have
answered the question?
2. Comment out the two lines after the "Initialization" label (comment). What happened? 1.e., is there
an error? If so, why? Restore the lines, or un-comment, by removing the // after you have answered the
question.
3.Comment out the two lines after the "Update" label (comment). What happens and why? Un-
comment the lines after you have answered the question.
12:43 PM
0 Type here to search
61°F
83
10/27/2021
12
< > | 1>
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- C++ PLEASE!! // FILE: simplestring.h// CLASS PROVIDED: string (a sequence of characters)//// CONSTRUCTOR for the string class:// string(const char str[ ] = "") -- default argument is the empty string.// Precondition: str is an ordinary null-terminated string.// Postcondition: The string contains the sequence of chars from str.//// CONSTANT MEMBER FUNCTIONS for the string class:// size_t length( ) const// Postcondition: The return value is the number of characters in the// string.//// char operator [ ](size_t position) const// Precondition: position < length( ).// Postcondition: The value returned is the character at the specified// position of the string. A string's positions start from 0 at the start// of the sequence and go up to length( )-1 at the right end.//// MODIFICATION MEMBER FUNCTIONS for the string class:// void operator +=(const string& addend)// Postcondition: addend has been catenated to the end of the string.//// void operator +=(const char addend[ ])//…arrow_forward#include <iostream>#include <sstream>#include <string>using namespace std; int main() { string userItem; ostringstream itemsOSS; cout << "Enter items (type Exit to quit):" << endl; cin >> userItem; while (userItem != "Exit") { cin >> userItem; } cout << itemsOSS.str() << endl; return 0;}arrow_forward#include <iostream> using namespace std; int main() { int num = 1; while (num < 30) { cout << num << “ “; num = num + 5; } } The fourth number displayed is ______arrow_forward
- // SumAndProduct.cpp - This program computes sums and products // Input: Interactive// Output: Computed sum and product #include <iostream>#include <string>void sums(int);void products(int);using namespace std; int main() { int number; cout << "Enter a positive integer or 0 to quit: "; cin >> number; while(number != 0) { // Call sums function here // Call products function here cout << "Enter a positive integer or 0 to quit: "; cin >> number; } return 0;} // End of main function// Write sums function here// Write products function herearrow_forwardP1b: Given the following code, now/what is printed string s1 = "baby ruth"; #address of s1 is ex3e string *s2= &s1; s1 = "dove bar"; *s2 = "cadbury"; cout << s1 <« endl; %3Darrow_forwardmain.cc file #include #include #include #include "cup.h" int main() { std::string drink_name; double amount = 0.0; std::cout << "What kind of drink can I get you?: "; std::getline(std::cin, drink_name); while (std::cout << "How much do you want to fill?: " && !(std::cin >> amount)) { // If the input is invalid, clear it, and ask again std::cin.clear(); std::cin.ignore(); std::cout << "Invalid input; please re-enter.\n"; } //================== YOUR CODE HERE ================== // Instantiate a `Cup` object named `mug`, with // the drink_name and amount given by the user above. //==================================================== while (true) { char menu_input = 'X'; std::cout << "\n=== Your cup currently has " << mug.GetFluidOz() << " oz. of " << mug.GetDrinkType() << " === \n\n"; std::cout << "Please select what you want to do with…arrow_forward
- // LargeSmall.cpp - This program calculates the largest and smallest of three integer values. #include <iostream> using namespace std; int main() { // This is the work done in the housekeeping() function // Declare and initialize variables here int largest; // Largest of the three values int smallest; // Smallest of the three values // Prompt the user to enter 3 integer values // Write assignment, add conditional statements here as appropriate // This is the work done in the endOfJob() function // Output largest and smallest number. cout << "The largest value is " << largest << endl; cout << "The smallest value is " << smallest << endl; return 0; }arrow_forwardQ in picture **C PROGRAMMING LANGUAGE ***PROVIDE COMMENTSarrow_forwardP1: Given the following code, what is printed string s1 = "baby ruth"; #address of s1 is ex3e string *s2= &s1; s1 = "dove bar"; cout <« *s2 « endl;arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education