Consider the following program: #include #include int main(void) char chSentence[100]: printf("Write a sentence. \n"); (caName); //Line 5: what is the string function to read In a sentence with spaces? printf( The sentence you wrote is:'96s'\n", chSentence ); l/main What is the C string function at Line 5, that can read in a sentence of more than two words sepearated by space?
Q: Problem 1 Write a "C" program to find the summation of the following series: 1/8+ 1/27 + 1/64 +…
A: 1) Below are two C programs for problem1 and problem 2 Program to find summation of the series In…
Q: 2. Write simple programs to illustrate the concepts of following in C++:- a. Program to calculate…
A: A)Program to find the area of various geometrical shapes by function overloading.…
Q: Q.1) Mark the following statements as true or false and correct the second part if false: 1. The…
A: Array is a collection of similar datatypes. The types of array are Single dimensional…
Q: Q3/ Write a C++ program, using function, that reads two integers (X and Y) and add them (3,5)?
A: cin used for user input cout used for displaying something in console <iostream> cin…
Q: Question Take a string input from the user and print a modified string where the characters in the…
A: ALGORITHM Step1 : take string input from the user and calculate its length using len() Step2:declare…
Q: I need a memory diagram of this C++ function: ***CODE*** #include using namespace std; int f2(int r,…
A: Memory diagram of the given code: #include <bits/stdc++.h>using namespace std;int f2(int r,…
Q: Q.4) What is the function of the following C++ Programs? Part A #include #include main () #include…
A: 1. Function of the program is to find average of 7 numbers 2. Function of the program is to find…
Q: Use the following C++ program to answer questions a – e. Given the following code: 1 #include 2…
A: Solution of the given question is:-
Q: What is the output of the following C++ programs? Part A # include # include # include # include…
A: Both the above programs have two header files included. One is iostream.h, which is for input/output…
Q: What will be the output of the following C++ code? 1 #include 2 int main() 4 int p - 123 int t-…
A: task: is to give output of the code provided in the question.
Q: The language we are using here is in Racket. Please enter the following code: (cond ((equal? 16…
A: 1) The return value of above code is 18. 2) When we replace all the 16s in the above code with 8 the…
Q: What is the C string function at Line 5, that can read in a sentence of more than two words…
A: Generally scanf is used to take input from user. But it doesn't allow spaces in it
Q: FOR C++, PLEASE SEND THE CODE IN 30 MINUTES. WRITE THE ANSER OF THIS QUESTION IN THE GIVEN CODE.…
A: // Check whether furniture's material has good quality in average. If the average// -- quality of…
Q: Use c++ Write a program whose inputs are three integers, and whose outputs are the largest of the…
A: C++ Code for smallest and largest among three numbers: #include <iostream> using namespace…
Q: 6- Write a C++ function to check if a number is a float. The correct float number comes in any of…
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT-------------
Q: What will be the output of the following C code? 1. #include int x - 5; void main() { 2. 3. 4. 5.…
A: The Answer is in Below Steps
Q: Q) Write a C ++ program to make a calculator that performs addition and subtraction of five numbers…
A: Given: C++ program to perform addition and subtraction of two numbers.
Q: 5. Consider the following c code: int k; int l; int *p; int *s; k=20; 1=30; p=&l; s=&k; *p= 5; What…
A: int k; int l; Above 2 lines defines 2 variable => k, l int *p; int *s; Above 2 lines…
Q: Consider the following program: #include #include int main(void) { char chSentence[100];…
A: C string function at line 5, that can read in a sentence more than two words seperated by space is:…
Q: 9. How many times is the text "We may run? printed if the code snippet given beloW is int i = 0; do…
A: 4 times int i = 0; do{ cout<<"We may C"; i++; if(i%4 == 0){…
Q: Write a function with the following header to format the integer with the specified width. def…
A: Program Plan: • format(number, width) function is used to append 0 to the number depending on the…
Q: Q2\ write a c++ program the summation of any integers numbers (1-to-x) entered by user, use the…
A: #include <iostream>using namespace std; void sum(){ int n,i; int sum = 0; cout…
Q: Consider the following function definition. double funcTest(string name, char u, int num, double…
A: The correct answer to this question is option a. double funcTest(string, char, int, double);
Q: Consider the following function: double mystery(int x, double y, char ch){if (x > 0 &&…
A: EXPLANATION: - The static_cast function converts character to integer here EXAMPLE: -…
Q: Suppose that you have the following function definition. int find(int x, int y){return (x + y - x *…
A: (a) The function call u = find (list1[0], v); is valid. Explanation: An integer arrays list1[0] and…
Q: 6. Write a program to do the following:- 1) Define the function BasicAllowanceCalc that takes the…
A: Given:- a function named BasicAllowanceCalc() that take argument salary in float…
Q: Question 2. Write a C function that replace a character by a blank (space) in a string. Both the…
A: The programming methodology for the program is given by: Including header files Function prototype…
Q: using c++ Write a program that read a word from user. Then, create a function void reverse(char s[])…
A: The C++ program along with the snapshot of code and output is given below.
Q: Consider the following C program. # include int main() { char s3; float s2; int s1; scanf("%d %f…
A: Explore and analyze the given options such as “5 H 1.2”, “H”, and “1.2” and check whether they are…
Q: Use C++, write the following functions. Each of these functions should have a single parameter --…
A: // Iterative CPP program to count total number // of consonants #include <iostream> using…
Q: Q5) Write a program in c++ to swap two integer numbers enter by user using following function…
A: A correct prototype should be as the syntax format <return type> functionname…
Q: Write a program that receives a value n and prints the expansion of the binomial (x + y) n. To do…
A: ** THIS PROGRAM IS WRITTEN IN PYTHON SINCE NO PROGRAMMING LANGUAGE WAS MENTIONED** #entry…
Q: Q2: Answer two of the following: 1- Write a C++ function that returns the sign of the number. The…
A: C++ program to solve the problems is given below.
Q: Write a function with the following header to format a posi- tive integer with the specified width:…
A: Program approach:- Import a package to get the standard I/O. Define a class. Define the main…
Q: Fill in the c code for the question below: Define the function: void deleteAtV1(int num[], int…
A: int num[10]={4,5,1,2,8}; int coun=5; deleteAtV1(num,&count,2); display(num,count); void…
Q: Q/ Consider the C-programs below to determine the following requirements: 1- Write a brief…
A: Array in C: An array is a set similar type of objects or elements stored at contagious memory…
Q: (Format an integer) Write a function with the following header to format the inte- ger with the…
A: Given: (Format an integer) Write a function with the following header to format the inte- ger with…
Q: In the following C program, there are some errors in different lines. In the provided table,…
A: C programming language is a case sensitive language. That means all the functions, variable and…
Q: PYTHON "Write a program that asks the user to enter a small text using the keyboard. Once the text…
A: Program Output Screenshot:
Q: 6. What will be the output of the following C++ code? 1. #include 2. using namespace std; 3. int…
A:
Q: About initial programming in python: a) Given a text stored in a string, make the function that…
A: Answer: Our guideline is solve first three question from the first so if multiple question contains…
Q: 2. In the following C code, what is the value of x? short Flag void main (void) ( 1; %3D int x; x =…
A: Flag is globally declared as 1 and thus initial value is 1 After entering into main, Flag is…
Q: use c code to Develop a function void printToggled(char str[]) that gets a string as a parameter and…
A: A C program is as follows, #include<stdio.h> //Function declaration void printToggled(char…
Q: Write a complete function called Main() that asks the user for an input string, then creates and…
A: Solution: Write a complete function called Main() that asks the user for an input string, then…
Q: #include int main() { const int *p; int a=10; p=&a; printf("%d",*p); return 0; }
A: The output of the following c code #include<stdio.h>int main(){const int *p;int…
Q: The topic is Booth's algorithm - Explain this C programming code - i have a seminar. //header files…
A: Booth's Multiplication Algorithm: Booth’s algorithm is a multiplication set of rules that multiplies…
Q: Q2: Write a whole C++ program that shows the following results by using construct and deconstruct…
A:
Q: Question 2. Write a C function that replace a character by a blank (space) in a string. Both the…
A: The program is implemented in C with structured approach. The program receives a string and the…
Step by step
Solved in 2 steps
- 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.C++ is my answer correct ? Write a function to convert a given string : Answer: #include <iostream> #include <string> using namespace std; void toUpper(string &str) { for (int i = 0; i < str.length(); i++) { str[i] = toupper(str[i]); } } void toLower(string &str) { for (int i = 0; i < str.length(); i++) { str[i] = tolower(str[i]); } } int main() { string str = "khaled"; toUpper(str); cout << str << endl; str = "MOHAMMED"; toLower(str); cout << str << endl; return 0; } Write a function to calculate the sum of the even number from 1 - 100. Answer: #include <iostream> using namespace std; int sumEven() { int sum = 0; for (int i = 1; i <= 100; i++) { if (i % 2 == 0) { sum += i; } } return sum; } int main() { cout << sumEven() << endl; return 0; }In C++ Please help (Count occurrence of each letter in a string) Write a function that counts the occurrence of each letter in the string using the following header: void count (const char s[], int counts []) where counts is an array of 26 integers. counts [0], counts [1], ..., and counts [25 ] count the occurrence of a, b, ..., and z, respectively. Letters are not case-sensitive, i.e., letter A and a are counted the same as a.Write a test program that reads a string, invokes the count function, and displays the non-zero counts as shown in the following sample run: (Note that c: 1 time are separated by exactly one space.)Show the Sample Output Using the Preceding InputExecution Result: command>Exercise07 37Enter a string: Welcome to New York!c: 1 timee: 3 timesk: 1 timeL: 1 timem: 1 timen: 1 timeO: 3 timesr: 1 timet: 1 timew: 2 timesy: 1 time
- Homework 10-2 Programming Challenge: 12 - Password Verifier Use the string data type. Do not use arrays of type char or any functions in the old "C String" libraries. Six characters? Seriously? Set the minimum password length to twelve characters. We will also require that the password not contain any space characters. In addition to the requirement that the password contain at least one upper case letter, one lower case letter, and one digit, add the additional requirement that the password contain at least one "special" character. We will consider any character that is printable, not alphanumeric, and not a space character to be "special." That includes punctuation, but may include additional non-punctuation characters. Unfortunately at our level of C++ it's more or less impossible for us to actually test passwords like Señor_99 but the ñ (with a tilde) would count as a special character using our rules. Write functions to complete these tasks as appropriate.Problem D. Durdle Game Using the function from the previous problem, write a function durdle_game(target) which takes in as an argument a single string that will be the target to guess, and lets the user attempt to guess the target word. Each time the user makes a guess, the function will print out the result of the previous function to tell the user how close they are. If the user guesses correctly, then the game is over. Have the function return the number of guesses that it took the user to get the correct answer. Examples (text in bold is returned, text in red is user input.): >>> durdle_game('trick') Welcome to Durdle! Enter a guess:touch GBBGB Enter a guess:trash GGBBB Enter a guess:truck GGBGG Enter a guess:trick GGGGG Congratulations, you got it in 4 guesses! 4 >>> durdle_game('stoop') Welcome to Durdle! Enter a guess:chart BBBBY Enter a guess:tones YYBBY Enter a guess:togas YYBBY Enter a guess:tofus YYBBY Enter a guess:stock GGGBB…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#
- 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; }; // 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 print the employee data to console void display(struct employees *e) { printf("%s", e->name); printf(" %d%d%d-%d%d-%d%d%d%d",…//I need help debugging the C code below// #include <stdio.h>#include <stdlib.h>struct employees{ char name[20]; int ssn[9]; int yearBorn, salary;}; // function to read the employee data from the uservoid 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 typestruct 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 print the employee data to consolevoid display(struct employees *e){ printf("%s", e->name); printf(" %d%d%d-%d%d-%d%d%d%d", e->ssn[0], e->ssn[1],…C++ is my answers correct ? Write a function to convert a decimal number to a binary number. Answer: #include <iostream> #include <string> using namespace std; string decToBin(int dec) { string bin = ""; while (dec > 0) { bin = to_string(dec % 2) + bin; dec /= 2; } return bin; } int main() { cout << decToBin(10) << endl; return 0; } Write a function to calculate s =1!+2!+3!+....+10! Answer: #include <iostream> using namespace std; int findFactSum(int n) { int f = 1, Sum = 0; for (int i = 1; i <= n; i++) { f = f * i; Sum += f; } return Sum; } int main() { int n = 10; cout << findFactSum(n); return 0; }
- Create using the c++ string class. Write a function that counts the occurence of each letter in the string using the following header: void count (const string& s, int counts [], int size) where counts is any array of 26 integers. counts[0], counts [1],...and counts [25] count the occurence of a, b,...and z, respectively. Letters are not case-sensitive, ie, A & a are counted the same as a. Write a test program that reads a string, invokes the count() function, and displays the non-zero counts. Here is a sample run of the program: Enter a string: Welcome to New York! c: 1 times e: 3 times k: 1 times l: 1 times m: 1 times n: 1 times o: 3 times r: 1 times t: 1 times w: 2 times y: 1 timesQuestion 3: Write a function that computes the ratio of vowels vs. consonants (????????????????����������������) in a given sentence. The ratio should be given as a floating-point number rounded off to two decimal places. When writing your function, be sure to appropriately cater for the following punctuation marks: apostrophes (') quotations (") full stops (.) commas (,) exclamations (!) question marks (?) colons (:) semicolons (;) Arguments: sentence (string) →→ sentence required to compute the ratio. Return: ratio (float) →→ a ratio that describes the number of vowels to consonants: vowels/consonants. ?HINT? Remember to cater for the white spaces that appear in your sentence. Expected outputs vowel_consonant_ratio("This is a random sentence!")==0.62 vowel_consonant_ratio("Thomas! Where have you been?")==0.83How could a create a function that drops the lowest grade on this grading calculator? For example: John 100 100 0 = D Create a function to drop the lowest grade so John 100 100 (0 dropped) = A #include<iostream>#include<string>using namespace std; char getGrade(double average){ if(average>=90)return 'A'; else if(average>=80)return 'B'; else if(average>=70)return 'C'; else if(average>=60)return 'D'; else return 'F';} void sort(string lastnames[] , char grades[], int n){ for(int i=0;i<n;i++){ for(int j=0; j<n-i-1;j++){ if(lastnames[j].compare(lastnames[j+1])>0){ string temp = lastnames[j];lastnames[j]=lastnames[j+1];lastnames[j+1]=temp; char t = grades[j];grades[j]=grades[j+1];grades[j+1]=t; } } }} int main(){ int students; int s1,s2,s3; double average; cout<<"This is an automatic grade calculator. Please enter the number of students in the class:\n"; cin…