Question

CHALLENGE ACTIVITY 13.1.2: Basic function call. Complete the function definition to output the hours given minutes. Output foCHALLENGE ACTIVITY 13.1.3: Function call with parameter: Printing formatted measurement Define a function PrintFeetinch Short

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

13.1.2 Basic Function call

CODE: C++ Programming Language

#include <iostream>
using namespace std;
void OutputMinutesAsHours(double origMinutes){
   /* Yout solution goes here */
   cout << origMinutes/60 << endl;
}
int main(){
   double minutes;
   cin >> minutes;
   OutputMinutesAsHours(minutes); // will be run with 210.0, 3600.0, and 0.0
   cout << endl;
   return 0;
}

SCREENSHOT OF THE CODE:

1 2 4 #include <iostream> using namespace std; 3 void OutputMinutesAsHours (double origMinutes){ /* Yout solution goes here *

OUTPUT:

C:\Users\Eswar\Desktop\newg++\open hour.exe 210.0 3.5 Process exited after 2.997 seconds with return value o Press any key toC:\Users\Eswar\Desktop\newg++\open hour.exe 3600.0 60 Process exited after 3.869 seconds with return value o Press any key toC:\Users\Eswar\Desktop\newg++ open hour.exe 0.0 0 Process exited after 3.703 seconds with return value o Press any key to con

========================================================================

13.1.3 Function call with parameter: Printing formatted measurement

CODE: C++ Programming Language

#include <iostream>
using namespace std;
/* Your solution goes here */
int PrintFeetInchShort(int numFeet, int numInches){
   cout << numFeet << "\'" << numInches << "\"" << endl;
}
int main(){
   int userFeet;
   int userInches;
   cin >> userFeet;
   cin >> userInches;
   PrintFeetInchShort(userFeet, userInches); // will be run with (5, 8), then (4, 11)
   return 0;
}

SCREENSHOT OF THE CODE:

1 #include <iostream> 2 using namespace std; 3 /* Your solution goes here */ 4 int PrintFeetInchShort(int numFeet, int numInc

OUTPUT:

C:\Users\Eswar\Desktop\newg++\open\formatted.exe 18 58 Process exited after 1.761 seconds with return value o Press any keyC:\Users\Eswar\Desktop\newg++ open formatted.exe 4 11 411 Process exited after 1.754 seconds with return value o Press any

Thank you.

Add a comment
Know the answer?
Add Answer to:
CHALLENGE ACTIVITY 13.1.2: Basic function call. Complete the function definition to output the hours given minutes....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Answer in JAVA 1. Complete the method definition to output the hours given minutes. Output for...

    Answer in JAVA 1. Complete the method definition to output the hours given minutes. Output for sample program: 3.5 import java.util.Scanner; public class HourToMinConv {    public static void outputMinutesAsHours(double origMinutes) {       /* Your solution goes here */    }    public static void main (String [] args) {       Scanner scnr = new Scanner(System.in);       double minutes;       minutes = scnr.nextDouble();       outputMinutesAsHours(minutes); // Will be run with 210.0, 3600.0, and 0.0.       System.out.println("");    } } 2....

  • C++ Write a function so that the main() code below can be replaced by the simpler...

    C++ Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original main(): int main() { double milesPerHour; double minutesTraveled; double hoursTraveled; double milesTraveled; cin >> milesPerHour; cin >> minutesTraveled; hoursTraveled = minutesTraveled / 60.0; milesTraveled = hoursTraveled * milesPerHour; cout << "Miles: " << milesTraveled << endl; return 0; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <iostream> using...

  • please solve CHALLENGE ACTIVITY 5.3.3: While loop: Insect growth. Given positive integer numinsects, write a while...

    please solve CHALLENGE ACTIVITY 5.3.3: While loop: Insect growth. Given positive integer numinsects, write a while loop that prints that number doubled without reaching 200. Follow each number with a space. After the loop, print a newline. Ex: If numInsects = 16, print: 16 32 64 128 1 #include <iostream> 2 using namespace std; von WN int main() { int numInsects; cin >> numInsects; // Must be >= 1 /* Your solution goes here */ 11 return 0; 12 }...

  • CHALLENGE ACTIVITY 8.4.2: Find char in C string Assign a pointer to any instance of searchChar...

    CHALLENGE ACTIVITY 8.4.2: Find char in C string Assign a pointer to any instance of searchChar in personName to searchResult. #include <iostream> #include <cstring> using namespace std; int main() { char personName[100]; char searchChar; char* searchResult = nullptr; cin.getline(personName, 100); cin >> searchChar; /* Your solution goes here */ if (searchResult != nullptr) { cout << "Character found." << endl; } else { cout << "Character not found." << endl; } return 0; }

  • This is for C program CHALLENGE ACTIVITY 6.5.1: Unit testing. Add two more statements to main0...

    This is for C program CHALLENGE ACTIVITY 6.5.1: Unit testing. Add two more statements to main0 to test inputs 3 and-1. Use print statements similar to the existing one (don't use assert) 1 #include <stdio.h> test 3 // Function returns origNum cubed 4 int CubeNum(int origNum) t 5 return origNum origNumorigNum; 6 b All tests passed 8 int main void) 10 printfC"Testing started\n"; printf("2: Expecting 8, got: %d\n", CubeNum(2)); 14 Your solution goes here 15 16 printfC Testing completed\n"; 17...

  • what is the output for the following code? explain the steps. /*#include <iostream> using namespace std;...

    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...

  • 81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5...

    81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5 );                    int BoxVolume(int length = {1}, int width = {1}, int height = {1});                                                     T__   F__                                                                     82. The following function is implemented to swap in memory the          argument-values passed to it:         void swap(int a, int b)                   {           int temp;             temp = a;             a = b;             b = temp;        ...

  • CGALLENE 4.2: More syntax errors. ACTIVITY Each cout statement has a syntax error. Type the first...

    CGALLENE 4.2: More syntax errors. ACTIVITY Each cout statement has a syntax error. Type the first cout statement, and press Run to observe the error message. Fix the error, and run again. Repeat for the second, then third, cout statement cout << "Num: "<< songnum << endl; cout << int songNum << endl; cout << songNum " songs" << endl; Note: These activities may test code with different test values. This activity will perform two tests: the first with songNum-5,...

  • Complete a partially written C++ program that includes a function that return a value. The program...

    Complete a partially written C++ program that includes a function that return a value. The program is a simple calculator that prompts the user of 2 number and an operation (+, -, * or, /). The two number and the operator are passed to the function where the appropriate arithmetic operation is performed. The result is return to the main function () where the arithmetic operation and result are displayed. For example 3 * 4 = 12 The source code...

  • Complete the second PrintSalutation function to print the following given personName "Holly' and customSalutation "Welcome": Welcome,...

    Complete the second PrintSalutation function to print the following given personName "Holly' and customSalutation "Welcome": Welcome, Holly End with a newline. 1 #include <iostream> 2 #include <string> 3 using namespace std; 4. 5 void PrintSalutation(string personName) { 6 cout << "Hello, << personName << endl; 7} 8 9 // Define void PrintSalutation(string personName, string customSalutation)... 10 11 y. Your solution goes here 12 13 int main() { 14 PrintSalutation("Holly", "Welcome"); 15 PrintSalutation("Sanjiv"); 16 17 return ; 18 ) Run

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT