1) Prompt the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space. (Submit for 2 points).
Q: 4. Assume X and Y are initialized variables of type double. Write the lines necessary to print…
A: 1) initialize two values x and y with double values. 2)check whether they two agree with seven…
Q: 2. Write a printf or scanf statement for each of the following: e) Read characters into array s…
A: The problem is based on taking the input from the user until the given condition is not satisfied.
Q: What is the output of the following code: #include int main(int argc, const char * argv[]) {…
A: Question. What is the output of the following code: #include <iostream> int main(int…
Q: 3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first…
A: The answer is given below.
Q: Q1. Write a program that takes a range from the user and display all the even numbers between the…
A: /* C++ program to print the even numbers within the given range */ #include…
Q: 7.11 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs…
A: - We need to highlight the code to reverse a string till we get the letter d for the word done.
Q: HW 2: Identifiers and assignments (associated with lectures 5, 6 and 7) Write a program that will…
A: C Program for above : #include <stdio.h> int main() { //get user input…
Q: 5.18 (Even or Odd) Write a program that inputs a series of integers and passes them one at a time to…
A: EXPLANATION - Firstly declare variables that are used in program . Then take input from user about…
Q: #include using namespace std; int g = 100; int main() { int a; { int b; b = 20; a = 35; g…
A: Given, C++ code: #include <iostream> using namespace std; int g = 100; int main() { int…
Q: 4. Write pseudo code that will perform the following. a) Read in 5 separate numbers and calculate…
A: Required:
Q: Q#05: Write output of the following program and remove error if you find any #include using…
A: There are few errors in the code which have to changed. for (i=1;;) --> for statement should be…
Q: 18 - What is the output of the following code?
A: The output of the following code is - Good Luck good luck
Q: Assuming the following declarations, write C++ expressions to set all integer values of b to 42.…
A: Given: //structure A struct A { //structure data m1 which is an integer array with size 2 int…
Q: 3. Write a code for craps game. Craps is a dice game in which the players make wagers on the outcome…
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: 3. Write a program that displays the following pattern: ***** *** * *** *****
A: As no programming language is mentioned, it is solved using basic C++
Q: 13. Write a program that reads in two integers and determines and prints if the first is a factorial…
A: Required: A program to read two integers and check if the first is a factorial of the second or not.…
Q: Write a program with total change amount as an integer input that outputs the change using the…
A: [Note: please use proper indentation to avoid erros. snapshots of program code are provided in step…
Q: 8. a. Trace Thru the following code. Simply display the output. What is the output of the following…
A: Let's understand what this code will do . We have one list 1,2,3,4,5,6 Next we have the for loop…
Q: 49- Find the output of the following program. main(){ int a 10, b, с; = a++; C = a; cout << a <« “ «…
A: int a=10,b,c; means a=10 and a=b means b=10 and a=c means c=10
Q: What would be the results after the following code was executed? int[ ]x = {3,5, 3}; int[ ]y {6,8,…
A: Please give positive ratings for my efforts. Thanks. ANSWER Here, the loop is executed only once…
Q: Q6: Write a program to find and print the value of (f) from the following equations for Fourteen…
A: Introduction:- Below is the complete solution with explanation for the given question in detail.…
Q: Q3 Let U = {5, 6 }, write an equivalent to the following assertions: 3x P ( x ) v - Vx Q ( x )
A: The answer is below:
Q: 3.19 LAB: Exact change Write a program with total change amount in pennies as an integer input, and…
A: Program: The program contains the set of instructions that are used to perform certain activities.…
Q: # EX 8 # print a block statement using one print function (give me 3 lines please) Use one print…
A: Print function in python to print statements in different lines
Q: Examples3: write e++ program to add two integet equal 6 and the second number equal 8? #include…
A: #include<iostream>//header file using namespace std; int main()//main method { int a=6;//…
Q: 2.1 Write regular expression for the following character sets, or reasons why no regular expression…
A: a - a[a-z]*a | a b - a[a-z]* | [a-z]*a | a [a-z]*a c - [1-9][0-9]* | 0 d -…
Q: or faster sorting of letters, the United States Postal Service encourages companies that send large…
A: Encoding number system:- Interchange (ASCII) The most widely used coding scheme is still ASCII.…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: The below given C++ program code will obey the following rubrics: Including necessary header files.…
Q: 2B. Given x=3 and y=6, what is the value of z after the expression z=x*y=%=18 is executed?
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: 2.15 LAB: Using math functions Given three floating-point numbers x, y, and z, output x to the power…
A: Given:
Q: 5. Given variables int areaBound and int sum, write a snippet of code that assigns to sum the result…
A: Here in this question we have asked to write a snippet of code that use while loop and Initially…
Q: 6.12) Since communications channels are often noisy, numerous ways have been devised to ensure…
A: the code is given below in c
Q: 4. Write a function int prime(int n) to test whether a number is a prime. Write a program to test…
A: Some interesting fact about prime numbers; Even only prime number. Every prime number represented…
Q: In each of the following code snippets, data is copied from x to y. How many bytes of data are…
A: SUMMARY: -Hence, we discussed all the points.
Q: 7-The final result of the following statements is u = [0 0 1 1 0 1]; v = [011001]; u|v
A: Answer in step 2
Q: 22. Show the output of the following code: #include using namespace std; int main() { cout << "3.5…
A: Here there are 3 operators given: * / and - * And / have more precedence than - therefore they will…
Q: 1. 1 NULL Write a code that contains the followings: Find '2' and print its position.
A: Data structure: The data structure is one of the main concepts of computer science that is used to…
Q: X = 2 + 3 * 4. What value will be assigned to the numeric variable x when the following statement is…
A: Here in this question we have given an expression x= 2+3*4 and we have asked what value will be…
Q: (2) Let P (x, y) : x plays in y." A(x): x is athletic." S(x) :x is smart." E(y) : y is in English…
A: Given: Let P (x, y): x plays in y. A(x): x is athletic." S(x) : x is smart." E(y): y is in…
Q: 7. Let the statements A, B be given by A: not(p or q), B: (not p) or q. Let T= true, F = false. If p…
A: Given , A: not( p or q ) ; p = T ; q = F . i.e A = not ( T or F ) A = not ( T ) A = F
Q: 7.18 LAB: A jiffy A jiffy" is the scientific name for 1/100th of a second. Define a function named…
A: Algorithm: 1. Take Input. 2. Read the function and return userJiffies/100. 3. Display Output to 3…
Q: 15. What is the output, if any, of the following C/C++ code? int a[5]=(3,4,5,6,7}; int…
A: Option a is syntax error because of main.c: In function ‘main’: main.c:9:13: warning: initialization…
Q: 2.15 LAB: Using math functions Given three floating-point numbers x, y, and z, output x to the power…
A: NOTE - As per the guidelines we can only answer one question in multi questions, so please repost…
Q: C++ Question, Write a Computer Code: Let l be a line in the x-y plane. If l is a vertical line, its…
A: #include <iostream> using namespace std; int main(){ float m,x1,x2,y1,y2,b; cout…
Q: 3. Write a program to add the following numbers and save the result in R20. Ох25, 0х 19, Ох12
A: Given: Write a program to add the following numbers and save the resut in R20. Given numbers:…
Q: 7) Write a code that content of AL is 10. Compare with 10. If numbers are equal, Jump to label NEXT…
A: Assembly language program to compare two numbers .
Q: 11. Write a Python function to check whether a number is perfect or not. Go to the editor According…
A: Answer in step2
Q: 7-The final result of the following statements is u= [001101]: v=[011001]; ulv
A: The given question is solved using MATLAB programming language.
Q: 3.13 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: coded in python to get the above output of exact changes (Python Language)
Q: 7.18 LAB: A jiffy Ajiffy' is the scientific name for 1/100th of a second. Define a function named…
A: Output: 15.250.152
1.23 LAB: Warm up: Variables, input, and type conversion
(1) Prompt the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space. (Submit for 2 points).
Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first six letters of the first name, followed by the first letter of the last name, an underscore (_), and then the last digit of the number (use the % operator). If the first name has less than six letters, then use all letters of the first name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: MichaeJ_1 Ex: If the input is: Nicole Smith 2024 the output is: Your login name: NicoleS_46.26 LAB: Exact change - functions Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies. def exact_change(user_total) Use Python, please.4.19 C++ Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleH yeH
- 5.28 LAB: Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: 6 the output is: 110 Your program must define and call the following two functions. The IntegerToReverseBinary() function should return a string of 1's and 0's representing the integer in binary (in reverse). The ReverseString() function should return a string representing the input string in reverse. string IntegerToReverseBinary(int integerValue)string ReverseString(string userString)7.24 LAB: Convert to binary-functions Write a program that takes in a positive integer as input, and outputs a string of 1's and O's representing the integer in binary. For an integer x, the algorithm is As long as x is greater than 0 Output x 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string Ex: If the input is the output is: 110 The program must define and call the following two functions. Define a function named int to reverse_binary() that takes an integer as a parameter and returns a string of 1's and O's representing the integer in binary (in reverse). Define a function named string reverse() that takes an input string as a parameter and returns a string representing the input string in reverse. def int_to_reverse_binary(integer_value) def string reverse(input_string) LAB ACTIVITY 7.24.1: LAB. Convert to binary-functions 0/10 1 # Define your functions here. 2…4.18 C++ Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. End with a newline. Ex: If the input is: -15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.
- 8.16 (Searching for Substrings) Write a program that inputs a line of text and a search string from the keyboard. Using function strstr, locate the first occurrence of the search string in the line of text, and assign the location to variable searchPtr of type char *. If the search string is found, print the remainder of the line of text beginning with the search string. Then, use strstr again to Locate the next occurrence of the search string in the line of text. If a second occurrence is found, print the remainder of the line of text beginning with the second occurrence. [Hint: The second call to strstr should contain searchPtr + 1 as its first argument.] Solve without using pointers5.23 In Python: Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.def exact_change(user_total)5.23 LAB: Exact change - functions Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.def exact_change(user_total) Note: This is a lab from a previous chapter that now requires the use of a function.
- C++ 10.19 Given a line of text as input, output the number of characters excluding spaces, periods, exclamation points, or commas. Ex: If the input is: Listen, Mr. Jones, calm down. the output is: 21 Note: Account for all characters that aren't spaces, periods, exclamation points, or commas (Ex: "r", "2", "?"). code provided: #include <iostream>#include <string>using namespace std; int main() { string userText; // Add more variables as needed getline(cin, userText); // Gets entire line, including spaces. /* Type your code here. */ return 0;}1. Examine the following code segment. What will be printed?If there are any errors indicate the nature of the error. int a[8] ={16, 12, 10, 7, 15, 18, 17, 29}; int *ptr ; ptr = & a[ 5 ] ; for(int i = 0; i<= 4; i = i + 2) cout<<a[i]<<*( ptr + i )<<endl; cout<<” ”<<a[1]<<” ”<<*ptr<<” ”<<*ptr + 2<<” ”<<*(ptr + 3);3. Write a code for craps game. Craps is a dice game in which the players make wagers on the outcome of the roll, or a series of rolls, of a pair of dice.The rules of the dice game craps are as follows:You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots, respectively. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, you win and play is over. If the sum is 2, 3 or 12 on the first throw you lose and play is over. If the sum is 4, 5, 6, 8, 9 or 10 on the first throw, that sum becomes your “point.” To win, you must continue rolling the dice until you “make your point” (i.e., roll that same point value). You lose by rolling a 7 before making your point. 4. Write a program which prompts the user for their age. If they are 19 or younger inform them that qualify for student discounts. If they are between 20 and 65 inform them that they qualify for no age…