The header file contains several classification functions. Assume that you don't have access to this header file. Write your own version of isdigit which returns true if a character is one of the digit characters in the range 0..9. main.cpp
Q: Briefly describe how the CDec function converts a string argument to a number.
A: Given: Briefly describe how the CDec function converts a string argument to a number.
Q: Write a Case clause that specifies all numbers less than 0.
A: Select...Case structure: The Select Case is used to specify the multiple alternative choices in a…
Q: Program Purpose - Professional Athletes often hire other professionals to help take care of matters…
A: the above project is solved:
Q: Please create a flowchart for this code: #include using namespace std; void display(int row) {…
A: Flow chart is a step by step process in which sequence of steps are connected with the flows. In the…
Q: Procedure Call Explanation concat (str1, Returns a single string consisting of strl followed by…
A: A is the answer. initials <- concat(prefix(firstName,1),prefix(lastName,1))
Q: Write a statement that converts the following string values to the decimaldata type using the…
A: The value 50 is the string literal. In order to convert this string value “”50” to the decimal the…
Q: Write a statement that declares a char variable named lastLetter and stores the last character of a…
A: Statement A character C# supports data type known as Char. A variable of the Char data type holds…
Q: the Tacter C appears m the C-string s. You cannot use any of the library functions from .…
A: #include<iostream> using namespace std; int countChar(const char* s,char c) { int count=0;…
Q: The Barking Lot is a dog day care center. Write a program that accepts data for an ID number of the…
A: Program description The program has following parts: -Prompt and accept user input -compute feel…
Q: Need help in explaining what the error is in the following code contents = '' infile =…
A: To open the file, we use the built-in open() function. The open() function returns a file object,…
Q: What is the output of the following code? #include <iostream>#include <string> #include…
A: #include <iostream>#include <string> #include "BMI.h" using namespace std;int main()…
Q: Please write the code for the removeBad function. Will thumbs up if correct!
A: Algorithm: Step 1: declare function removebad containing list as parameter. Step 2: loop run from…
Q: ex1="I like numbers containing 7 such as 77, 177, 7897, 6757, 77097, but I do not like numbers…
A: Since there are multiple questions posted, the only first question can be solved according to…
Q: Form1 should accept weight and height values and return body mass index. The body mass index formula…
A: C# CODE :- using System; namespace string[] values = Console.ReadLine().Split(' ');int w =…
Q: Please Write a function to validate please make the code in java like this function validate()…
A: The program is written in HTML and Javascript. Please find the source code and output in the…
Q: Create a tuple that contains course codes: ('2400', '3560', '3140', '3040','4100', '4700', '4500')…
A: 1- Create a tuple with the given values. Name the tuple as courses. 2- Create a new tuple with the…
Q: ?lf a column is defined as NUMBER(5,2), which of the following is true The column can store a total…
A: Given:
Q: a- char() b- Charat() c- charat() d- charAt() Which of these method of String class is used to…
A: I have provided answer in step2.
Q: Review the following code, find the error in the code: contents = infile = 'thefile.txt', 'r')…
A: Here we have a variable named content of type string. Next, we need to open the file in read mode.…
Q: ed Notepad 10e Edit format View Help rite a single APL statement that gives values for the current,…
A: According to OHM'S Law I=E/R Where I =current, E is voltage and R is Resistance
Q: Which data types are appropriate for storing the number 4.5?
A: The data type appropriate for storing 4.5 is shown below
Q: Which of the following statements best describes what the following code is doing? LIBNAME stat480…
A: Understanding: The LIBNAME statement associates the library name "stat480" to the physical location…
Q: Write a statement that converts the following string values to the decimaldata type using the…
A:
Q: In the receiving procedure’s header, you use the keyword __________to indicate that a variable is…
A: Passing arguments in Visual Basic The arguments can be passed to procedures in visual basic either…
Q: What does the following error message normally mean: IndentationError: unexpected indent Select one:…
A: Introduction: When writing python code, we have to define a group of statements for functions and…
Q: Ask the user to enter the new rating for food. Validate the rating. If the rating is not within the…
A: Objective: This program receives details of some restaurants (like food and service ratings) and…
Q: Consider the following code segment: If dblHeight <= 100 Then dblHeight = dblHeight * 0.66 Else…
A: If-Else is just a conditional statements where If block gets executed if specified condition is True…
Q: Using VB The following condition verifies that the strWords variable is not empty. So, please…
A: the complete code for strWords Not null is in step2 .
Q: When a digital machine reads blood pressure from a human body it displays two numbers they are…
A: Solution: Note : Complete Executable C++ code is attached at Step - 3. 1.Implementation of…
Q: Q2.1 Assume all necessary header files and namespace have been included. Is there any error in the…
A: - We have to evaluate the code for correction.
Q: Suppose you want to maintain the highest and lowest temperatures for every day of a year. What kind…
A: We will use a 2-D array of size double arr[365][2], at 0 index we will store min temp and at 1 index…
Q: Write a program to use the check_input to create a list of valid temperatures and compute their…
A: C++ is a very famous programming language these days, It is an Object oriented programming, which is…
Q: What header files must be included in the following program? int main() { double amount = 89.7;…
A: Given: What header files must be included in the following program? int main() { double amount =…
Q: What does the following code display?values = [2] * 5print(values)
A: values = [2] * 5print(values) Here the number inside [] square bracket means we are creating a…
Q: You have to define the data type declaration for a variable that will store a string of text of 100…
A: The general syntax for declaring a variable as a String in C is as follows, char…
Q: When you try to access to a local variable outside the function an error is generatedSelect one:a.…
A: Scope refers to the visibility of variables. In other words, which parts of your program can see or…
Q: The following condition verifies that the strWords variable is not empty. So, please complete the…
A: length() function is used to find length of string. Note:- please mention programming language name…
Q: Program Purpose - Professional Athletes often hire other professionals to help take care of matters…
A: The required program written with a GUI in Visual Studio is shown below.
Q: You are given a string of any length. Return a new string consisting of the first and last…
A: full code :
Q: (True/False): The PROC directive can contain a USES operator, but the PROTO directive cannot.
A: PROC directive The PROC directive is one of the assembly directives that identify the beginning of…
Q: Write a statement that converts the following string values to the decimaldata type using the…
A:
Q: Fix the following code:
A:
Q: A) Freate application Ollect all the following marks and then calculate your final marks based on…
A: According to the information given;- we have to write c# code on the basis of instruction mention.
Q: Nhat is wrong with the following code? #include using namespace std; void displayString (string);…
A: Given: #include <iostream> using namespace std; void displayString(string) int main() {…
Q: Study the following code segment and identify the line that will cause a syntax error int mylist (51…
A: myList is an integer array
Q: The code below produces a 5 x 10 box of question marks. Convert the code into a function called…
A: In your code, in function header to make drawChar as a default argument, with default value 'X', you…
Q: Create a user-defined function that calculated the Reynolds number pVD μl Re= where p is the fluid…
A: The user defined function is given below along with VBA code and sample data
Q: What value is displayed as a result of executing the code segment? 3 В 4 C 12
A: Given :
C++
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- please code in pythonis_phone_num: This Boolean function takes a string and returns True if it is in the formatddd-ddd-dddd, where d is a digit, False otherwise. Example calls:is_phone_num('123-456-7890') --> Trueis_phone_num('123-4556-7890') --> Falseis_phone_num('(123)456-7890') --> FalseC++ Fix this code so that it displays in the format like the image shown where the principal and rate should have a fixed precision of 2 for each of the five percentages 5%,6%,7%,8%,9%,10%. The amount of the deposit should not have the fixed precision and should remain in the decimal format. #include <iostream>#include <iomanip>#include <cmath>using namespace std; int main(){double principal{ 1000 };double rate{ 0.05 }; for (rate; rate <= 0.10; rate += 0.01) {cout << "" << endl;cout << "Initial principal: " << principal << endl;cout << "Interest Rate: " << rate * 100 << "%" << endl;cout << setw(4) << "Year" << setw(20) << "Amount on deposit" << endl;for (unsigned int year{ 1 }; year <= 10; year++) {double amount = principal * pow(1.0 + rate, year); cout << setw(4) << year << setw(20) << amount << endl; }}}1.Write a program that will read in the names (multiple-word string, ie with blanks) and sales amounts (float) for 2 staff members. It will then print the values in the following format. Use gets() functions to read the string values. Use field modifiers to format the output, so that the field width for staff name is 20 and it is left-justified. The field width for sales amount is 12 with 2 decimal places. (Use C++ (stdio.h, printf...) to create the program.) Enter staff name > Ang Boon Ching Enter sales amount > 2500.00 Enter staff name > Tong Eng Fang Enter sales amount > 900.00 Staff Name Sales Amount ==================== ============ Ang Boon Ching 2500.00 Tong Eng Fang 900.00
- Finish a C++ code. Assume the <iostream>, <fstream>, and <string> headers have already been included and that main() looks like this: (picture 1) Each row of the capitals.txt file contains the following data, in this order: The city (string, one word) The state (string, one word) The population (integer) (picture 2, of the capitals.txt text) Text to copy for the capitals.txt file: Phoenix Arizona 1660272 Austin Texas 964254 Ohio Columbus 892553 Indianapolis Indiana 867125 Denver Colorado 716492 Boston Massachusetts 694583 Nashville Tennesseee 635710 Sacramento California 466488 Atlanta Georgia 420003 Honolulu Hawaii 359870 Create a function named smallestCapital as follows: The function returns an integer.The function has 5 parameters:Two string arraysOne integer arrayAn ifstream objectAn integer for the length of the arraysThe function should be coded as follows:If the ifstream object did not open the file, return a value of -1.Otherwise, use a while loop to read…I need a function that takes a string and returns initials such as Bob Burnett becoming B.B. string CreateAcronym(string userPhrase);int main() {while (true){string userPhrase;getline(cin, userPhrase); if (userPhrase == "") {break; }cout << CreateAcronym(userPhrase) << endl;}return 0;}string createAcronym( const string && userPhrase ) {int i;string acronym;bool use_next = true; for (i=0; i < userPhrase.size(); i++){char character = userPhrase.at(i);int ascii = (int)character;if(ascii > 64 && ascii < 91 && use_next == true){acronym += character;use_next = false;} else if(ascii == 32){use_next=true;}else{use_next = false;}}return acronym;} Please fix my program using c++.Write a function, named randomPassword, that generates a random password that takes noparameter. It will return the randomly generated password as its ONLY result. Display the randomlygenerated password in the main program. Password Criteria:o The password should have a random length of between 7 and 10 characters.o Each character should be randomly selected from positions 33 to 126 from the ASCII table. 1. You must import randint function directly and inline within the random package and it must be thefirst line of code in your program 2.Declaring and using FOUR constants 3. You must use the chr built-in function within your randomPassword function.4. Declaring the main function and invoking randomPassword function. 5. Please do NOT use any special formatting in your print statement.6. Do not use __main__ anywhere in your program code. Sample runs : Run 1. your random password is : "Y)IC>Vm Run 2. your random password is : WM,L8"7 this is the error I am getting Please let me…
- Write a function, named randomPassword, that generates a random password that takes noparameter. It will return the randomly generated password as its ONLY result. Display the randomlygenerated password in the main program. Password Criteria:o The password should have a random length of between 7 and 10 characters.o Each character should be randomly selected from positions 33 to 126 from the ASCII table. 1. You must import randint function directly and inline within the random package and it must be thefirst line of code in your program 2.Declaring and using FOUR constants 3. You must use the chr built-in function within your randomPassword function.4. Declaring the main function and invoking randomPassword function. 5. Please do NOT use any special formatting in your print statement.6. Do not use __main__ anywhere in your program code. Sample runs : 1. your random password is : "Y)IC>Vm 2. your random password is : WM,L8"7C++ You are required to write three overloaded functions called stringOperation that take in the following formal parameters list: Function 1: takes as input a string, ONE character, and an integer n, and returns true if the string contains that character EXACTLY an n number of times. Function 2: takes as input a string and TWO alphabatical characters c1 and c2, and returns true if all the string characters fall in the range between the two passed characters (exclusive) (You must make sure to order the characters first if c2 < c1 ). Function 3: takes as input a string and THREE alphabatical characters c1, c2 and c3. The function reorders the characters in asecnding order, such that c1 holds the smallest character and c3 holds the largest character. The function returns true if the string characters that fall between c1 and c2 (exclusive) is less than the string characters that fall between c2 and c3 (exclusive). Do not write and submit the main subroutine, or any include…C++ code please Write a program that uses the function isPalindrome . Test your program on the following strings: madam, abba, 22, 67876, 444244, trymeuemyrt Modify the function isPalindrome so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. Your program should print a message indicating if a string is a palindrome: madam is a palindrome Use expressions: .+*isPalindrome\(\"Madam\"\).+* .+*isPalindrome\(\"abBa\"\).+* .+*isPalindrome\(\"22\"\).+* .+*isPalindrome\(\"67876\"\).+* .+*isPalindrome\(\"444244\"\).+* .+*isPalindrome\(\"trYmeuemyRT\"\).+* in the code.
- C++ 10.17 Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs Yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: Yes Ex: If the input is: 42,000 or 1995! the output is: No Hint: Use a loop and the isdigit() function (don't forget to include the cctype library). CODE PROVIDED: #include <iostream>#include <string>#include <cctype>using namespace std; string solve(string userStr) { int start; if(userStr[0]=='-' && isdigit(userStr[1])){ start=1; } else{ start=0; } for(int i=start; i<userStr.length();i++){ if(!isdigit(userStr[i])){ return "No"; } return "Yes" }}Create a function that accepts a string (of a person's first and last name) and returns a string with the first and last name swapped. Examples NameShuffle("Donald Trump") - "Trump Donald" NameShuffle ("Rosie O'Donnell") - "O'Donnell Rosie" NameShuffle ("Seymour Butts") - "Butts Seymour" • There will be exactly one space between the first and last name. In c#I need to write a header file for my C++ code: #include <iostream>using namespace std; class Fraction{ private: int numerator, denominator; public: Fraction() { numerator = 1; denominator = 1; } Fraction(int n, int d) { numerator = n; if (d==0) { cout << "ERROR: ATTEMPTING TO DIVIDE BY ZERO" << endl; exit(0); } else denominator = d; } Fraction Sum(Fraction otherFraction) { int n = numerator*otherFraction.denominator+otherFraction.numerator*denominator; int d = denominator*otherFraction.denominator; return Fraction(n/gcd(n,d),d/gcd(n,d)); } int gcd(int n, int d) { int remainder; while (d != 0) { remainder = n % d; n = d; d = remainder; } return n; } void show() { if (denominator == 1) cout << numerator << endl; else cout <<…