Run the following C program. What is the value of variable “b” at the end of the program?
Q: c++ Write a function that returns a float value. The function will check the users entry. It will…
A: The code is given below.
Q: I ned help programming this C++ program: Write a C++ console application that calculates and…
A: C++ Code: #include <iostream>using namespace std; float calculateCharges(int hours) { //…
Q: C++ Functions provide a means to modularize applications Write a function called "Calculate" takes…
A: double squareArea(double side) { double lArea; lArea = side * side; return lArea; }
Q: C++ Demonstration: Write a program that computes the equivalent resistance of a purely series and…
A: Introduction C++ Demonstration: Write a program that computes the equivalent resistance of a purely…
Q: Write a C++ function that accept one input argument only. The input could be a string, int, float or…
A: A variable uses a datatype while getting declared to restrict the type of data it stores. The data…
Q: Programming language: c++ (1) Prompt the user for a string that contains two strings separated by a…
A: Programming Approach: Including necessary header files. Remove leading and trailing spaces. Splits…
Q: 6.12 LAB: Parsing dates Complete main() to read dates from input, one date per line. Each date's…
A: Initialize a map called "months" that associates the names of months with their corresponding…
Q: the code editor, there's already an initial code that contains the function declaration of the…
A: Please find the answer below :
Q: void change( int a[]) , the compiler converts the parameter to: Select one: a. int *const a b. int…
A: The compiler changes void change(int a[]) silently to void change(int *const a) at the time of…
Q: 1- define a second argument (example "int number2 = 9") and a pointer to it 2- define a second…
A: The function accepts two integer references and adds the numbers present in both references and…
Q: In C++ Important Coding Guidelines: Use comments, and whitespaces around operators and…
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT…
Q: Instructions: In C++ Programming, write a program that calculates and prints the monthly paycheck…
A: 1. Start the program.2. Define constants for tax rates and deductions including Federal Income Tax,…
Q: Write a program to generate a random number between 1 - 100, and then display which quartile the…
A: In this question, we are asked to generate random number and display in which quarter it exist.…
Q: QUESTION: Write a C++ program that will generate and display a magic square. A magic square is a…
A: C++ code #include<iostream>#include<iomanip>using namespace std; const int MAX_SIZE =…
Q: // FixedDebugFive04 // Program prompts user for any number of values // (up to 20) // and averages…
A: Algorithm: Start Declare an array of 20 numbers Initialize a constant integer QUIT to 999…
Q: Each of the following definitions and program segments has errors. Locate as many as you can and…
A: void showValues(int nums[ ]) *// Definition of the function showValues. { for (int…
Q: In C++ Programming, write a program that calculates and prints the monthly paycheck for an employee.…
A: The following steps need to be taken for the given program:First, we set the constant values for the…
Q: Use c code to add the function in the program to provide for purchase amount of RM80.00 or more, the…
A: Q: Use c code to add the function in the program to provide for purchase amount of RM80.00 or more,…
Q: C++ - When analyzing data sets, such as data for human heights or for human weights, a common step…
A: Step 1:- Program Approach:- (i)Declare one header file (ii)Declare 3 variable of type integer…
Q: C++ 1 year = 15 months 1 month = 30 days write a function that takes an int parameter that…
A: logic:- number of days as per the given requirement will be calculated by multiplying 15 months*30…
Q: JAVA CODE PLEASE Functions With No Parameters and Return Values Practice ll by CodeChum Admin Create…
A: Step-1: StartStep-2: Declare a global variable global and initialize with 1Step-3: Start a loop till…
Q: stfix) Write a program that converts an infix expression into an equivalent postfix expression. The…
A: Dear Student, The required code along with implementation and expected output is given below -
Q: C++ Programming Exercise: When you borrow money to buy a house, a car, or for some other purpose,…
A: PROGRAM: //Header file #include<iostream> #include<iomanip> //Using namespace using…
Q: In C++ Language: (Check password) Some websites impose certain rules for passwords. Suppose the…
A: Step-1) Defining a function for password validity asbool ValidPassword(const std::string&…
Q: C++ Programming I Program 4: C++ Craps Game Functions in files, random numbers , stringstream…
A: C++ is a general-purpose programming language. It is an extension of the C programming language with…
Q: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;) Dynamic…
A: Given: Static Variable: a variable whose lifetime is the lifetime of the program (static int x;)…
Q: Please do in C++ coding please Nrite a program to fulfill the following requirements: You need a…
A: Introduction : This program could be implemented using a while loop. The loop would run until the…
Q: LISP Programming only A function that generates a random day of the week, then displays a message…
A: In this Lisp program, we'll write a function that chooses a random day of the week and outputs a…
Q: Employee Salary Calculator Program and Analysis Demonstrate an understanding of C++ programming…
A: Start. Declare three variables of double type, namely, standardHours, rateOfPay, and overtimeHours.…
Q: C++ CODE ONLY: Write a program that takes as input five numbers and outputs standard deviation of…
A: Code: #include <iostream>#include<bits/stdc++.h>using namespace std; float mean(int ,…
Q: ● Write a program that lets the user perform arithmetic operations on two numbers. Your program must…
A: Dear Student, The required code along with implementation and expected output are given below -
Q: C++ You are required to write a universal calculator that performs DOUBLE UP of different types of…
A: Add math. h,bits/stdc++.h in your header files section. #include <math.h> #include…
Q: Computer Science I need to write a program in C that allows the user to play a game of Mystery Word,…
A: The solution to the given problem is below.
Q: The following declaration, program, and program segment has errors. Locate as many as you can.…
A: One may want to set a default value for the property member, and therefore when not started would…
Q: C++ PROGRAMMING Create a C++ program that accepts an English sentence and converts it to Pig Latin.…
A: Output :-
Q: 1) Find the errors in the following codes: int Main() { } int { Hanging Indent #include ; int a =…
A: The above question is answered in step 2 :-
Q: In C/C++, True or False: A function that changes the value of a variable passed by reference also…
A: Answer is given below
Q: Question 2: Grade Calculation Program - designing You will write a python program to compute the…
A: def validateMarks(mark): # Validate marks if mark < 0 or mark > 100: # Check if mark is…
Subject: C programming
Question 3
Run the following C program. What is the value of variable “b” at the end of the program?
!!! YOU NEED TO WRITE ONLY NUMBER WITHOUT ANY SPACE OR ANY OTHER CHARACTER OTHERWISE YOU CANNOT TAKE ANY POINTS !!!
#include <stdio.h>
int fn1(int a) {
a = a / 2;
a = a + 5;
a = 9 * 6;
return a;
}
int main() {
int b;
int c;
b = 10;
b = fn1(b);
c = b;
b = b * c;
return 0;
}
Your answer:
Step by step
Solved in 2 steps
- C PROGRAMMING HELP I need help with an old script of mine. I'm having trouble getting math involving accessing an array to work properly, I'm getting an error message that's puzzling me. I'm pretty sure the solution is simple and right in front of me but it's stumping me. Below is the script: #include <stdio.h>#include <math.h>void value(float x){ printf("what is the value of x?"); scanf("%f",&x); }void power(float i,int p,int x,float arr[100]){ float equation,butt; printf("what is the highest power in the series?"); scanf("%d",&p); for (i = 0; i < p; ++i) equation = pow(x,i); //how the hell do i get the counter to do what i want butt = 1+equation^arr[i];}void shortcut(int x){ shortcut = 1/(1-x)}int main(){ printf("Here is the result!:") printf("%d %f", p, f); printf("If we had used shortcut, value would be: %d", shortcut); int diff; diff = shortcut - butt; printf("The difference is only %0.2f!",diff);…// SumAndProduct.cpp - This program computes sums and products // Input: Interactive// Output: Computed sum and product #include <iostream>#include <string>void sums(int);void products(int);using namespace std; int main() { int number; cout << "Enter a positive integer or 0 to quit: "; cin >> number; while(number != 0) { // Call sums function here // Call products function here cout << "Enter a positive integer or 0 to quit: "; cin >> number; } return 0;} // End of main function// Write sums function here// Write products function hereNote:solution using c++ language Pre-Lab 01: Write a program that reads a positive integer x from the user. If x is even, the program prints all the odd numbers between 1 and x – inclusive - each on a separate line. If x is not even, the program prints all the numbers that are multiples of 4 between 1 and x+10 -inclusive -, each on a separate line. Note: As long as the user does not enter a positive number, the program will repeatedly ask the user to enter a positive number. The program must also print an error message "Error- TRY AGAIN – You should enter a positive integer to continue". Úe do.. while to insure the user input.
- Language: C++ (Apartment problem) A real estate office handles , say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: The total number of units. The rent to occupy all the units. The increase in rent that results in a vacant unit. Amount to maintain rented unit. The program then outputs the number of units to be rented to maximize the profit. Note: Please include the pseudocodeIn C++ Programming, write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the following deductions: Federal Income Tax: 15% State Tax: 3.5% Social Security Tax: 5.75% Medicare/Medicaid Tax: 2.75% Pension Plan: 5% Health Insurance: $75.00 Your program should prompt the user to input the gross amount and the employee name. The output will be stored in a file. Format your output to have two decimal places. A sample output follows: Bill Robinson Gross Amount: .......................... $3575.00 Federal Tax: ................................ $ 536.25 State Tax: .....................................$ 125.13 Social Security Tax: ................... $ 205.56 Medicare/Medicaid Tax: ......... $ 98.31 Pension Plan: .............................. $ 178.75 Health Insurance: .......................$ 75.00 Net Pay: ....................................... $2356.00 NOTE: The first column is left-justified, and the right column is…This assignment is not graded, I just need to understand how to do it. Please help, thank you! Language: C++ Given: Main.cpp #include #include "Shape.h" using namespace std; void main() { /////// Untouchable Block #1 ////////// Shape* shape; /////// End of Untouchable Block #1 ////////// /////// Untouchable Block #2 ////////// if (shape == nullptr) { cout << "What shape is this?! Good bye!"; return; } cout << "The perimeter of your " << shape->getShapeName() << ": " << shape->getPerimeter() << endl; cout << "The area of your " << shape->getShapeName() << ": " << shape->getArea() << endl; /////// End of Untouchable Block #2 //////////} Shape.cpp string Shape::getShapeName() { switch (mShapeType) { case ShapeType::CIRCLE: return "circle"; case ShapeType::SQUARE: return "square"; case ShapeType::RECTANGLE: return "rectangle"; case…
- THIS IS FOR C++ ONLY Part 2b: Password Verification A secure password is critically important in today's world. Organizations typically have stringent requirements to ensure a password is complex enough so as not to be easily hacked. Write a program that will accept as input a potential password and determine whether or not it is valid in meeting the following criteria: at least eight characters long at least one uppercase letter at least one lowercase letter at least one digit at least one special character (you can determine what is acceptable) If the password is valid, ask the user to enter it again. If it matches, indicate the password has been accepted. If the password does not meet any of the above criteria, indicate which it does not meet.#include // Function to calculate the factorial of a given positive integer int factorial(int n) { // TODO: Implement the factorial function here } int main() { int num; printf("Enter a positive integer: "); scanf("%d", &num); // TODO: Call the factorial function and print the result } return 0; • Q1: Write a C program to calculate the factorial of a given positive integer entered by the user.Fundamentals of Programming in C Language Write the value of each of the following expressions, using the following data declarations: double m = 17.5; int y = 9; 1. (m > 12.0) && (y / 2 <= 4) 2. (y % 3 != 0) 3. (m < 2 * y) 4. (2 == 3) || (m - 16 >= 0)
- C++ printSmaller is a function that accepts two int parameters and returns no value. It will print the value of the smaller one parameters. The function protoype is as follows: void printSmaller(int num1, int num2); write the statments to read two integers and call this function to display the smaller one.Create a C++ Grocery Program according to this guideline: Linked List Functions Pointers Arrays The program must have a menu layout where the user can select certain action (Select Product, View My Cart, Check-Out, etc.) You must include all kinds of drinks/beverages Implement basic error tapping IYou must include the group name of the developers with the name of each developer (a total of 4) Group Name: In-Out Group Names: Cesar Rachel Jennifer TomProgramming Language: C++ 4. Select the two correct statements about stub functions: Select one or more: a. stubs are used to test the functionality of a program b. stubs must return a value c. stubs are programs that test if a called function returns the correct result d. stubs are simpler than the functions they replace