Concept explainers
// This
#include <iostream>
using namespace std;
int main()
{
int choice, num1, num2;
do
{
cout ≪ "Enter a number: ";
cin ≫ num1;
cout ≪ "Enter another number:
cin ≫ num2;
cout ≪ "Their sum is " ≪ (num1 + num2) ≪ endl ;
cout ≪ "Do you want to do this again?\n";
cout ≪ "1 = yes, 0 = no\n";
cin ≫ choice;
} while (choice = 1)
return 0;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (7th Edition)
C++ How to Program (10th Edition)
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- Nonearrow_forward8. Determine the value of variable num1, num2 and num3 at the end of the following code. int product(int A, int *B){ *B += 1; A *= *B; return A; } int main(){ int num1 = 2, num2 = 3, num3; num3 = product(num2, &num1); O A. num1 = 3, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 6 %3D D. num1 = 3, num2 = 2, num3 = 6 B.arrow_forwardint x1 = 66; int y1 = 39; int d; _asm { } mov EAX, X1; mov EBX, y1; push EAX; push EBX; pop ECX mov d, ECX; What is d in decimal format?arrow_forward
- void funOne(int a, int& b, char v); void main() { int num1=10; char ch='A'; funOne(num1, 15,ch)<arrow_forward#include using namespace std; int main() 3 { int x,y; or (x=0; x 3) break; cout << y << endl; }}} O O 10 O 5 04arrow_forwardNonearrow_forwardNonearrow_forwardNumber guessing Game Write a C program that implements the “guess my number” game. The computer chooses a random number using the following random generator function srand(time(NULL)); int r = rand() % 100 + 1; that creates a random number between 1 and 100 and puts it in the variable r. (Note that you have to include <time.h>) Then it asks the user to make a guess. Each time the user makes a guess, the program tells the user if the entered number is larger or smaller than its number. The user then keeps guessing till he/she finds the number. If the user doesn’t find the number after 10 guesses, a proper game over message will be shown and the actual guess is revealed. If the user makes a correct guess in its allowed 10 guesses, then a proper message will be shown and the number of guesses the user made to get the correct answer is also printed. After each correct guess or game over, the user decides to play again or quit and based on the user choice, the computer will make…arrow_forwardFind errors / syntax error. Write line numberarrow_forwardNonearrow_forwardbe recor #include #include minutes #include limit on int func(int, int, int, int); main(){ srand(time(NULL)); int a, b, c, fNum; printf("Choose three different numbers between 0-39:"); scanf ("%d%d%d", &a, &b, &c); fNum = func (a, b, c, 25); printf("\nThe result: %d", fNum); } int func (int ul, int u2, int u3, int iter){ srand (time (NULL)); int n1=0, i=0, count=0; for (;iarrow_forwardC++ Please Help!arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_iosRecommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage