Concept explainers
What is the output of the following
#include <iostream>
void friendly();
void shy(int audienceCount);
int main()
{
using namespace std;
friendly();
shy(6);
cout << “One more time: \n”;
shy (2);
friendly ();
cout << “End of program. \n”;
return 0;
}
void friendly ()
{
using namespace std;
cout << “Hello \n”;
}
void shy(int audienceCount)
{
using namespace std;
if (audienceCount < 5)
return;
cout << “Goodbye \n”;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Modern Database Management (12th Edition)
Computer Science: An Overview (12th Edition)
Database Concepts (8th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
- #include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…arrow_forwardJavascript Programming <script>function getCardType() {var cNum1 = document.getElementById("ccNum1").value;var cardname = "";if (cNum1 != "") {if (cNum1.startsWith("4")) {cardname = "Visa";} else if (cNum1.startsWith("5")) {cardname = "MasterCard";} else if (cNum1.startsWith("6")) {cardname = "Discover";} else if (cNum1.startsWith("3")) {cardname = "American Express";}}document.getElementById("cardType").innerHTML = cardname;}</script></body>arrow_forwardQuestion - 2) Create a C# Console application(DOT net framework) using Visual Studio IDE. Project name should include students' firstname(s) followed by A1(Example: HarleenHardeep_A1) (Submission Instruction: sumbit the Zipped project folder) In this project. Rename Program.cs to A1Q2.cs. In A1Q2.cs do the following tasks: Step 1 Declare variables of different data types (at least 10 variables). Assign valid literals to those variables. Step 2) Step 3) Print the values of the variables using format strings and placeholders in Console.Write() Console.WriteLine(). 2 | Page ASSIGNMENT 1 CSD 2354 (C#) Print values of some variables in following formats: i) Currency Number Hexadecimal, iv) Percentage. Embed comment lines before each Console.WriteLine and explain, how the format strings and placeholders work. Perform some arithmetic operations on the variables you declared in step 1. You should demonstrate the use of following arithmetic operations +,-,/, * and % Demonstrate the use of…arrow_forward
- PLEASE HELP ME! ? Maximize and use alternative method to this code! package com.btech.pf101; import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.calendar; import java.util.date; public class pawnshopcode { private static final bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); private static string name; private static int age; private static string address; private static string contactno; private static int itemtype; private static string itemtypename; private static final int itemtype_gagdet = 1; private static final int itemtype_jewelry = 2; private static final int itemtype_musicinstrument = 3; private static final int itemtype_homeequipment = 4; private static final int itemtype_landtitle = 5; private static string itemdescription; private static int periodtype; private static string periodtypename; private static final int periodtype_days = 1; private…arrow_forwardA return; else #include using namespace std; void division (int num, int denom); int main() { division (5, -1); division (10, 2); return 0; } void division (int num, int denom) {if (denom using namespace std; int main() (char List[4][10] = {"kareem", "ahmed", "ali", "mohamed"}; cout<arrow_forward5. Given the following code AFIFOQueue aQue = new AFIFOQueue (10); AStack astack - new AStack (10); for (int i = 1; i <1e; i++) { aQue. Enqueue (i); } for (int i = 1; i <=5; i++) { astack. Push( aQue.Dequeue ()); } while(!astack . Empty ()) aQue. Enqueue (astack.Pop()); a. After the above code is executed, what is the content of the queue? (Fill in the content of aQue below) Indicate where the front and rear are located. b. What is the content of astack?arrow_forwardIn Python, grades_dict = {'Wally': [87,96,70], 'Eva': [100,87,90], 'Sam': [94,77,90], 'Katie': [100,81,82], 'Bob': [83,65,85]} Write your own describe function that produces the same 8 statistical results, for each one of the columns, that the built-in describe() function does. Note 1: Use the sample standard deviation formula (that is, the denominator is: N-1) Note 2: Your algorithm should work for any number of columns not just for 5 Note 3: You can use the np.percentile() for the 25% and 75% percentile as well as the sort() built-in functionsarrow_forwardBasic Computer Programming ActivityLanguage: CShow the code and how it works thanksarrow_forwardWhat value will be returned by the function if a = 8, b=12? %3D int func(int a, int b){ if(a>b){ return a+b; } else if(aarrow_forwardfunction loginValidate () { var id = document.getElementById ('myid').value; var pass = document.getElementById('mypassword').value; if ((id == null : id alert ("ID and Pasword both must be filled out") : "") && (pass == null , pass == ")){ == return false: else if (id == null || id == "") { alert ("ID must be filled out "); return false; else if (pass == null || pass == "") { alert ("Password must be filled out "); return false;arrow_forwardAnalyze the following code: int x = 0;int y = ((x < 100) && (x > 0)) ? 1: -1; The code has syntax error. y becomes 1 after the code is executed. y becomes -1 after the code is executed. The code has run time error.arrow_forwardJAVA PROGRAMFILL IN THE BLANKSarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_iosRecommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,