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
What does the following program print?
#include
using std::cout;
using std::endl;
int main()
{ int count = 1;
while ( count <= 10 )
{ cout << (count % 2 ? "****" : "++++++++") << endl;
++count;}
return 0;}
Expert Solution
arrow_forward
Step 1
Use <iostream> besides include command to run code properly in C++.
Step by stepSolved in 2 steps with 2 images
Knowledge Booster
Similar questions
- Finish the following code: void Divide (int dividend, int divisor, bool& error, float& result) // Set error to indicate if divisor is zero. // If no error, set result to dividend / divisor. { using namespace std; // For debugging cout << "Function Divide entered." << endl; cout << "Dividend = " << dividend << endl; cout << "Divisor = " << divisor << endl; //** // Rest of code goes here. //** // For debugging if (error) cout << "Error = true "; else cout << "Error = false "; cout << "and Result = " << result << endl; cout << "Function Divide terminated." << endl; }arrow_forward## Q3. Finding the largest number from three numbers. **C++ #include using namespace std; int findLargest3(int a, int b, int c) { int largest; // Put your code here return largest; int main() { int a, b, c; cout > a; cin >> b; cin >> c; cout << "The largest number is " <« fingLargest3(a, b, c) « endl; return 1; *Hint 1: Considering the case that the two or three numbers are equal.*arrow_forwardQuestion p.this is c++ language Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forward
- 04 5 02 using namespace std; int main() { int x = 2; { X = X+1; X++; } cout << x; return 0; int x = 5; {1+arrow_forwardê #include using namespace std; int main() { int count = 5; int num = 2; while (count r && num ){ cout << count << " " << num << endl; count -=1; if (count % 2 == 0) num -=1; } return 0; Output: 52 4 1 3 1 20 10arrow_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_forward
- #include using namespace std; Type the program's output int main() { int g; g = 0; while (g >= −2) { } cout << g << endl; g = g - 1; return 0;arrow_forwardThis is the C code I have so far #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for (int i = 0; i < 9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to print the employee data to console void display(struct employees *e) { printf("%s", e->name); printf(" %d%d%d-%d%d-%d%d%d%d",…arrow_forwardC++ shapes.h: #include <iostream>#include <cmath>struct Point2d{double x;double y;void print(){// example: (2.5,3.64)std::cout << "(" << x << "," << y << ")" << std::endl;}double length() const{return std::sqrt(x * x + y * y);}// const Point2D & ==> function can't modify 'other'// the second const ==> function can't modify x, yPoint2d add(const Point2d &other) const{Point2d result;result.x = x + other.x;result.y = y + other.y;return result;}};// example of an interfacestruct Shape{virtual bool contains(Point2d p) = 0;};struct Circle : Shape{Point2d center;double radius;bool contains(Point2d p){Point2d diff;diff.x = p.x - center.x;diff.y = p.y - center.y;double distToCenter = diff.length();return distToCenter <= radius;}};// TODO: replace this with your Rectangle implementationstruct Rectangle : Shape{// TODO: which member variables to model a rectangle?bool contains(Point2d p){return false; // TODO }};//…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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