1) #include <iostrem> should be #include <iostream>
3) int min() should be int main()
7) sum = num1 + num2;
8) cout << "The sum is " >> sum; should be cout << "The sum is " << sum;
9) retrn 0; should be return 0;
(F) Specify the errors of the following code? 1) #include <iostrem> o stream 2) using namespace...
Fix this code so only the function prototype comes before main. #include <iostream> using namespace std; bool isMultiple(int num1, int num2) { return num1 % num2 == 0; } int main() { char ch = 'Y'; int num1, num2; while(ch =='Y') // While ch is equal to Y { cout << "Enter two numbers(largest first): "; cin >> num1; // Getting 1st number cin >> num2; // Getting 2nd number if(isMultiple(num1, num2)) cout << num2 << " " << "IS...
Write the missing statements for the following program. #include <iostream> using namespace std; int main(void) { int Num1; cout << "Enter 2 numbers: "; cin >> Num2; if (Num1 < Num2) cout << "Smallest number is " << Num1; else cout << "Smallest number is " << Num2; return 0; }
#include <iostream> #include <unistd.h> using namespace std; int main() { // your code goes here int num1, num2, num3; int *p_num1 = &num1; int *p_num2 = &num2; *p_num1 = 15; *p_num2 = 10; num3 = *p_num1 * *p_num2; return 0; } whats the value of num3
Extra Credit: What is the output of the following program? (5 points) #include <iostream> using namespace std; int main ( char greetingl6]- ('H', 'e', T, T, 'o', 0'); cout <<"Greeting message: " cout< greeting << endl return 0;
what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...
Need a FLOW Chart for that code.
#include <iostream > using namespace std; int PowerFive(int); //Function prototype declaration int main() for (int i=-10 ; i(z10; 1++) {//for each # cout<<"("<< ǐ<<") ^5. "<<PowerFive(1)くくendl;// calling the defined Function int PowerFive (int a) //Function definition return a*a*a*a*a;
Convert the below code into if else selection: #include <iostream> using namespace std; int main() { int num; sin. >> num; switch (num) { case 1: cout << "Casel: Value is: << num << endl; break; case 2: break; case 3: cout << "Case3: Value is: " << num << endl; break; default: cout << "Default: Value is: << num << endl; break; } return; }
How to convert C++ code to C #include<iostream> #include <stdlib.h> using namespace std; void multiplication() { int num1; int c, num2, ans; cout<<"Enter difficulty level(1/2)\n"; cin>>c; if(c==1) { num1= rand() % 10; num2= rand() % 10; cout<<"what is"<<num1 <<"*"<<num2<<"?\n" ; cin>>ans while(ans!=(num1*num2)) { if(ans!=(num1*num2)) { cout<< "No. Please try again.\n"; cout<<"what is"<<num1 <<"*"<<num2<<"?\n" ; cin>>ans; } } } else if(c==2) { num1= rand() % 10+90; num2= rand() % 10+90; cout<<"what is"<<num1 <<"*"<<num2<<"?\n" ; cin>>ans; while(ans!=(num1*num2)) { if(ans!=(num1*num2)) { cout<< "No....
4) What is the output if the input istom - Sawyer? #include <iostream> using namespace std; int main() { string playerName; cout << "Enter name"; cin >> playerName; cout << endl « playerName; return 0; } a. Tom - Sawyer b. Tom Sawyer c. Tom d. Sawyer 5) Which XXX generates "Adam is 30 years old." as the output? #include <iostream> using namespace std; int main() { string name = "Adam"; int age = 30; XXX return 0; } a....
* The output of the following code is #include <iostream> using namespace std: int prod (int x, int y=3){ int d; int a=x*y; return (a); int main ({ cout << prod (7) <<" "<<prod (6, 4); return 0; 21 12 O 49 24 O 21 24 O 21 18