Quiz Q4) What the output of this program after correcting the errors in it? #include using namespace std; int main () { string str = "Hello" cout >> "str is : << str << endl; str += ", "; 11 str += cout << "str is : << str << endl; char s; str + "everyone"; cout << "s is : S = << s << endl; char ch = '!'; s += ch; cout << "s is : << s << endl;
Q: 4) #include using namespace std; int main() { int a = 32, *ptr = &a; char ch = 'A', &cho = ch; cho…
A: It is stated to determine the output of the program given. It is a c++ program, it can be executed…
Q: "he two header files a .h and b.h both have a prototype for a single function. Both have at least…
A: The mistake is fixed below:-
Q: 1. Write and test a function letterCounts(text) that calculates how many times each letter of the…
A: I give the code in Python along with output and code screenshot
Q: #include using namespace std; char let; int Final (int &num1, int num2); double Final (double…
A: Given: #include <iostream> using namespace std; char let; int Final (int &num1, int num2);…
Q: What is the output of given code: #include using namespace std; int add(int a,int b){ return (a+b);…
A: Execution starts from main() int a=5, b=3; value will be intialized to a is 5 and b is 3…
Q: 3.41 Write function lastF() that takes as input two strings of the form 'FirstName' and 'LastName',…
A: def lastF(FirstName,LastName):name="'"name=name+LastNamename=name+","+FirstName[0]+"'"return…
Q: #include #include struct employees { char name[20]; int ssn[9]; int yearBorn, salary;…
A: Code is implemented in dev C++ :- There are 2 errors:- 1) To run this line struct employees *emp =…
Q: The output of this program is:(6,8,5) #include using namespace std;void add (int a,int b){int…
A: The function add is multiplying the parameter values and printing its value and this will be the…
Q: #include using namespace std; void add_3 (int &a){ a = a + 3; int main () { int a = 10; add_3 (a);…
A: Given Program: What type of parameter passing is this Program. #include <iostream> using…
Q: 4. A) Write a program which read a two- digit integer within the range 20 - 99. The task is to print…
A: Provided the C program for both the questions as per given requirement in above question. For Q4B…
Q: Big C , Enhanced eText .• E6.14 Write a function void bar_chart(double values], int size) that…
A: I cant figure out how to do the proportional thing you are asking, but I have coded up the basics,…
Q: What will the following C++ code do? #include #include #include using namespace std; int main() {…
A: Given, Code: #include <iostream> #include <string> #include <algorithm> using…
Q: Fill in the blanks above C++ code. !!! DO NOT USE ANY WHITESPACE ! #include include #include…
A: Fill ups: #include <cstdlib> using namespace std; int myArray [10]; for(int i = 0; i < 10;…
Q: Write exactly these 3 functions: power(x,y), print(text, number) function and the main() function.…
A: The given c++ program will return integer result that is calculated by raising a number x
Q: this is what i have #include #include using namespace std; /* Define your functions here. */…
A: I have implemented the PrintMenu() and ExecuteMenu() as per the given description..
Q: SORU 3. (QUESTION 3.) 1 #include using namespaces std; 3 intmain() 4日{ flaot a=6,b=8,c=4,…
A: GIVEN:
Q: Void main ) { int i-3, j-5,K=8; ans Choose the correct A The result f the ollowing program is #…
A: Here we have variable declared as i=3, j=5, k=8 Then we call function M() and pass value of i, j, k…
Q: ВВBBB BBBB Q2) write a C++ program to generate the following pattern using the functions…
A: The question ask to print the following pattern such that the character and space computation should…
Q: I need a function that takes a string and returns initials such as Bob Burnett becoming B.B. string…
A: A C++ program takes the phrase as input and displays its acronym. the acronym is an abbreviated word…
Q: Write a function that reverses a string. The header of the function is: def reverse(s):Write a test…
A: Given: Write a function that reverses a string. The header of the function is: def reverse(s):Write…
Q: sequence Write a function sequence that accepts an number (int) and that prints a sequence of…
A: ALGORITHM:- 1. Declare the sequence function. 2. Apply all conditions inside the function…
Q: 5) #include using namespace std; int main() { int arr[] = { 4, 5, 6, 7 }; int* p = (arr + 1); cout…
A: code: //include the necessary header #include<iostream> using namespace std; //main method int…
Q: #include using namespace std; int main () int a, b, C; a = 2; b = 7; (a > b) ? a : b; cout << c;…
A: - We need to get the output of the code provided. - The code provided :: #include <iostream>…
Q: A palindromic prime is a prime number and also palindromic. Example, 131 is a prime and alse…
A: Solution :
Q: Q 1) Find the error and also run the program and show the output of the given program. /******** A…
A: given code: task: to find the error, run and provide output
Q: //////////// //////////// //////////// please help me solve this problem in java
A: Program Instructions:Use scanner class object to read the three integers.Create a method names…
Q: The caret, when found at the start of a character set, is the equivalent to "not" in RegEx. The…
A: Regular expression that matches any character except letters, digits and spaces code written in…
Q: Rewrite the following C++ code by using function. Note the aim of this code is to count how many…
A: #include <iostream> using namespace std; int countCapital(string str){ int count=0; for…
Q: Q1. Fix the given C++ program with proper namespaces and scope resolution operators. */ #include…
A: Introduction of Program: The C++ program depicts the concept of the namespace and namespace provides…
Q: 7. [10] (Display Pattern) Write a C++ function called pattern that displays a pattern of stars and…
A: In this program, you need to write C++ function called pattern and also need to write main function…
Q: Use function GetUserInfo to get a user's information. If user enters 20 and Holly, sample program…
A: Completing the given C++ program so, that it can follow the given rubrics:In the main function,…
Q: 21.1 LAB: Fun with characters Complete the check character() function which has 2 parameters: A…
A: logic:- check if word[index] greater than ‘a ‘ and less than ‘z’ then return character…
Q: # include using namespace std; int sum (int , int ); int c = 1; int main () int a, b; cout « "enter…
A: PROGRAM CODE: # include <iostream>using namespace std;int sum(int , int ) ;int c = 1;int…
Q: Program 3: Write a value-returning function isVowel that returns the value true if a given character…
A: Aim: Write a value returning function isVowel to find if a character is a vowel or not. The program…
Q: o call any function you must write its name and arguments arguments O index name O
A: To call any function you must write it's name and arguments Answer is option a name and arguments
Q: #include using namespace std; int rectArea (int len, int wid) { return len * wid; } int main…
A: The given program is to calculate the area of rectangle given length and width of rectangle.
Q: #include using namespace std; void myfunction(int num2, int num1); lint main() { my function (5,2);…
A: Answer in step 2
Q: the longest sequence of increasing numbers. Use the function: void longestSeq
A: Below the C program for the longest sequence of increasing numbers
Q: C++ and Python are required to achive the goal
A: Code: #include <iostream> #include <Python.h> #include <string> #include…
Q: Python program - It must show the correct final grade debug the code: subjects = ["Math",…
A:
Q: Hello, I ned some help with this exerise question for my advance data sturcture class
A: I give the correct code , output and code screenshot along with the explanation of why your code is…
Q: The caret^. when found at the start of a character set, is the equivalent to "not" in RegEx. The…
A: Here i write code to check according the question: code: import re txt = " alice15@gmail.com " x =…
Q: 公 * 00 9. Write the has_same_words_count user defined function, call it, and print out the results:…
A: 1. define the two strings str1 and str2 2. now call the function has_same_words_count(str1, str2) 3.…
Q: The caret, when found at the start of a character set, is the equivalent to "not" in RegEx. The…
A: In this problem, we need to design the code in the Python programming language. Input - String…
Q: Write a function str_replace that takes three strings, str1, str2 and str3; and replaces the first…
A: def str_replace(str1, str2, str3): str1 = str1.replace(str2, str3, 1) return str1
Q: 21.1 LAB: Fun with characters Complete the check_character() function which has 2 parameters: A…
A: Given: Complete the check_character() function which has 2 parameters: A string, and a specified…
Q: (Fibonacci Series) The Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, ... begins with the terms 0 and…
A: // Part a #include <iostream> using namespace std; void fibonacciSeries(int number){ int…
Q: What will be the output of code given below. #include using namespace std; int main() { int n=12;…
A: In given code a loop is there which runs until value of n is not zero. Since initial value of n is…
Q: The following code outputs 25, 50, and 15. Given the highlighted line, how would you use the global…
A: In C++, scope resolution operator (::) is used to access the global variable. if you have a local…
Q: Q1 B// find the error and type and then bulid ST? #include "iostream" void main() 1 const…
A: There are many errors in the given c++ code:- The main blunder is in the fourth line of the code…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- 17.49 Lab: Functions: Number to words Sometimes numbers are converted to words, like in a wedding invitation. So 23 becomes "twenty three". Write a function DigitToWord that takes a single digit number from 0-9 and returns that number's word: 0 is zero, 1 is one, 2 is two, etc (if the number is outside 0-9, return "error"). Write another function TensDigitToWord that takes a single digit number from 2-9, and returns that number's word when it appears in the tens digit: 2 is twenty, 3 is thirty, etc. If the number is outside 2-9, return "error". Finally, write a function TwoDigitNumToWords that takes a two-digit number from 20-99 and returns that number in words. Your main program should get a user's integer, call TwoDigitNumToWords, and output the resulting string. If the input is 23, the output should be "twenty three". Do not do any error checking of the input. Note that your program does not support all numbers. 0-19 will yield error output, for example. HINTS: Write…(Modify) Rewrite the following programs to conform to good programming practice and correct syntax: a. #include using namespace std; int main( ){ cout << “The time has come” ; return 0;} b. #include using namespace std; int main ( ){cout << “Newark is a city\n”;cout << “in New Jersey\n”; cout << “It is also a city\n” ; cout << “in Delaware\n” ; return 0;} c. #include using namespace std; int main() {cout << Reading a program\n”;cout << “is much easier\n” ; cout << “if a standard form for main is used\n” ; cout <<“and each statement is written\n”;cout << “on a line by itself\n” ; return 0;} d. #include using namespace std; int main ( ){ cout << “Every C++ program” ; cout <<“\nmust have one and only one” ; cout << “main function” ; cout << “\n The escape sequence of characters”) ; cout << “\nfor a newline can be placed anywhere” ; cout <<“\n in the message passed to cout” ; return 0;}Assume that word is a variable of type String that has been assigned a value. Assume furthermore that this value always contains the letters "dr" followed by at least two other letters. For example: "undramatic", "dreck", "android", "no-drip". Assume that there is another variable declared, drWord, also of type String. Write the statements needed so that the 4-character substring word of the value of word starting with "dr" is assigned to drWord. So, if the value of word were "George slew the dragon" your code would assign the value "drag" to drWord. can't figure out what's wrong with my code!
- Question 3: Code conversions (a) Re-write the following program by changing ternary / conditional operator to if-else statement. #include<iostream> using namespace std; int main(){ int Num1, Num2, Num3; cout<<”Enter the first number\n”; cin>>Num2;cout<<”Enter the second number\n”; cin>>Num3; (Num2<Num3)? Num1=Num2 : Num1=Num3; cout<<”The smallest Number is: ”<<Num1; return 0; }17.54 PRACTICE: Functions***: Output guitar tabs C++ An earlier problem introduced guitar tabs. In this problem, the user can enter a sequence of chords, and the program should output the tabs in sequence. The first input is the number of chords to follow. If the input is 4 G C G D, the output should be: e|-3-0-3-2- B|-0-1-0-3- G|-0-0-0-2- D|-0-2-0-0- A|-2-3-2--- E|-3---3--- Hints: Use 6 C++ strings, one for each guitar string ("string" below will mean C++ string unless otherwise noted). Start by the e string with "e|-", the B string with "B|-", etc. For each user chord, append (using append()) to each string the appropriate item (a number or -) plus -, like "2-". When done, print the 6 strings one at a time separated by newlines.Topic: Function with default argument value covered in Chapter 6 Write a C++ Do not use any topic not covered in lecture. There is no need for use of loop, and needs the use of only an "if/else" statement. Write exactly these 3 functions: power(x,y), print(text, number) function and the main() function. The power(x,y) function returns an integer result that is calculated by raising a number x (integer) to a power y (integer). The second argument y (exponent) of the function can not exceed 100.If the second argument exceeds 100, the function should return -1. Your power(x,y) function must be able to take either 1 or 2 integer arguments using the concept of default argument in chapter 6. Look at the main() code to deduct what the default value should be. You should call C++ pow(x,y) function in the "cmath" library in the body of your power(x,y) function to avoid doing the power calculation yourself. The print(text, number) function is the only one that does output to the console using…
- 21.1 LAB: Fun with characters Complete the check_character() function which has 2 parameters: A string, and a specified index. The function checks the character at the specified index of the string parameter, and returns a string based on the type of character at that location indicating if the character is a letter, digit, whitespace, or unknown character. Ex: The function calls below with the given arguments will return the following strings: check_character('happy birthday', 2) returns "Character 'p' is a letter"check_character('happy birthday', 5) returns "Character ' ' is a white space"check_character('happy birthday 2 you', 15) returns "Character '2' is a digit"check_character('happy birthday!', 14) returns "Character '!' is unknown" Use Python, please.Quarterly Sales Create a program in c++ , that gets quarterly sales from a user and calculates the total of all four quarters as well as the average, lowest, and highest quarters. Console The Quarterly Sales program Enter sales for Q1: 12312.57 Enter sales for Q2: 15293.21 Enter sales for Q3: 14920.95 Enter sales for Q4: 23432.21 Total: 65958.94 Average Quarter: 16489.74 Lowest Quarter: 12312.57 Highest Quarter: 23432.21 Specifications Create the pseudocode needed to implement the solution above. Convert your pseudocode to C++ code including the following specifications: Round the average quarter to a maximum of 2 decimal digits. Use a vector to store the sales for each quarter. Use STL algorithms to process the data for the quarters.Question 9 nag.Write a program in C# that prompts the user to enter any string phrase and capitalizes the first letter of each word in the string. I need it to be user prompted, please! Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line
- Question 1 is already done need help with the others though This is the C code I have so far #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; struct employees **emps = new employees()[10]; //Added new statement ---- bartleby // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for(int i =0; i <9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to…Q3: Write a program in which user is asked to enter two integers (divisor and dividend) and computes the quotient and remainder. To compute quotient and remainder, both divisor and dividend should be integers.i) How to convert all the C code to C++(stdio.h) #include<iostream>using namespace std;int main(){ const int b=14; const float f=0.20; cout<<"----------------"<<endl; cout<<"BOOK LOAN SYSTEM"<<endl; cout<<"----------------"<<endl; cout<<"Enter the number of books : "; int n; cin>>n; cout<<"\nEnter the days of the loan : "; int l; cin>>l; cout<<"\n-------------------------------------"<<endl; cout<<"Days overdue : "; if(l>b){ cout<<l-b; cout<<"\nFine : RM "<<(l-b)*(f)*n; }}