What is the output of the following C++ program segment? string names[] = {"Blair, Cindy", "Johnson, Chris","Mann, Sheila"};string str1, str2;char ch = ',';int pos, length; for (auto &str: names){pos = str.find(ch);length = str.length();str1 = str.substr(0, pos);str2 = str.substr(pos + 2, length - pos - 1);str = str2 + ' ' + str1;}for (auto str: names)cout << str << endl;
Q: Write a function recursively_count_vowels() which accepts a pointer to a string, and any other…
A: //include the required header files #include<stdio.h> #include <string.h> //declare…
Q: Create a function that accepts a string (of a person's first and last name) and returns a string…
A: Coded using C#.
Q: Part A Find a list of all of the names in the following string using regex. In [ ]: import re def…
A: The answer is given below:-
Q: eed a C++ program to book a plane ticket. strictly use the below program defination. if you can…
A: Required: Need a C++ program to book a plane ticket. strictly use the below program defination. if…
Q: Hello, I was making a hangman simulation in C++. The code runs, but not fully. Could you identify…
A: I have found the errors and modified the code. Now it is working completely. The changes were:…
Q: Strings in C have a terminal character at the end of the array, while integer arrays, for example,…
A: Introduction: A unique "null" character is used at the end of C strings to show that they're done.…
Q: What is the correct syntax of declaring array of pointers of integers of size 10 in C++? a) int arr…
A: Given: What is the correct syntax of declaring array of pointers of integers of size 10 in C++? a)…
Q: Q2 / Write a program in C ++ using rows to calculate the remaining area of a square of side length a…
A: A square is flat square, in one plane, defined by four points at the four corners. A square has four…
Q: The problem is from Introduction to Programming and Data Structures with C++, 4th edition…
A: Please refer below for your reference: Language used is C++ 1/8 increment means 0.125 so…
Q: IN JAVA Create a function that takes two strings and returns their total as a unit of letters.…
A: The required code for the Java program has been coded in the next step with comments for…
Q: In C programing(not C++ or C#), how can I complete my code for the expected output? Comments are…
A: The C program to solve the problem is given in the below steps.
Q: What is the output of the following C++ program segment? int list[] = {15, 18, 3, 65, 11, 32, 60,…
A: Given program: #include <iostream> using namespace std; int main() { int list[] = {15, 18,…
Q: Declare and initialize an array of student, pass array to a function and display the values. To…
A: In the main function, the pointer of type Student is declared. Any size may be assigned to it. In…
Q: Write a C programming to find out maximum and minimum of some values using function which will…
A: There Are two questions I have solved first one means 2.
Q: Error Message: error: 'stoi' was not declared in this scope price=stoi(token);
A: ->stoi function will not work for C++11 below version. Make sure your compiler settings are…
Q: IN JAVA Create a function that takes a string and returns the number of alphanumeric characters that…
A: I give the code in Java along with output and code screenshot
Q: ... #include #include #include /* * Function to check whether two passed strings are anagram…
A: #include<stdio.h>#include <conio.h>#include<string.h> /* * Function to check…
Q: FOR C++, PLEASE SEND THE CODE IN 30 MINUTES!!! PLEASE ANSWER THIS QUESTION IN THE GIVEN CODE Write…
A: Everything is mentioned in the comments make sure you check them for understanding…
Q: Need a C++ program to book a plane ticket. strictly use the below program defination. if you can…
A: Required: Need a C++ program to book a plane ticket. strictly use the below program defination. if…
Q: What is the output of the following C++ code? vector<int> intList(5);for (int i = 0; i < 5;…
A: code: //include the headers #include <iostream> #include<vector> using namespace std;…
Q: Write a program in C language that accepts integers as command-line arguments. The number of…
A:
Q: Complete the following C++ programs into Pep/9 assembly language: NOT MACHINE LANGUAGE, START BR…
A: Note : As per our guidelines , we are supposed to answer 1 question . Please repost other questions…
Q: Task 2: Implement the function Searchingstrings that allow to search a sub-string in a given string…
A: The solution for the above-given question is given below:
Q: How to write a C programming, the question asked to be just in Array and String without using…
A: Write a program that resembles a phone book, which stores and displays the names, the…
Q: This is for my C++ 2 class, so still a beginner C++ program: Case Manipulator Write a program…
A: The code is given below.
Q: C++, PLEASE SEND THE CODE IN 30 MINUTES!!! PLEASE ANSWER THIS QUESTION IN THE GIVEN CODE Write a…
A: We need to define the 3 functions as per the given description.
Q: n C, string arrays have a terminal character, whereas integer arrays do not. What makes you think…
A: Intro In C, string arrays have a terminal character, whereas integer arrays do not. What makes you…
Q: I need help with this problem! write a C++ code to add 5 to the list between 4 and 6 -기 기 꾸 class…
A: I give the code in C++ along with output and code screenshot
Q: LEASE FIX THE CODE PROPERLY BELOW AND MAKE SURE IT WILL RUN PROPERLY ONLY USE C LANGUAGE BECAUSE ITS…
A: Task : Given the C Code. The task is to fix the code.
Q: IN JAVA Create a function that takes a string and returns the number of alphanumeric characters that…
A: In this problem, we need to create a function that takes a string and returns the number of…
Q: Please Answer this in C++: Write code to read a list of song durations and song names from input.…
A: #include <iostream> #include <string> #include <vector> using namespace…
Q: 2- Write a C# program that read a string and split this string according to space char into an array…
A: A space ( ) separated list of items from a file and we want individual items in an array. Almost…
Q: I need complete explanation of c++ code line by line. Need Explanation of all lines of code what is…
A: Introduction of the Program: The C++ program displays the concept of ATM deposit and withdraw and to…
Q: What is the output of the following C++ code? vector<int> intList(7);intList[0] = 5;for (int i…
A: PROGRAM: //Defining the required header files #include <iostream> #include <vector>…
Q: Several websites will implement password rules. Write a C++ program that uses a function to check…
A: The complete C++ Program along with the comments is given below:
Q: Need a C++ program to book a plane ticket. strictly use the below program definition. if you can…
A: Required: Need a C++ program to book a plane ticket. strictly use the below program defination. if…
Q: Question 1 Write a program in C that takes two integers, M and N, as command line arguments and then…
A: Below is the required code in C and sample output: As per company guidelines we are supposed to…
Q: A C-string variable is an array, so we can use index operator [ ] to access individual character.…
A: Given: A C-string variable is an array, so we can use index operator [ ] to access individual…
Q: What is the main difference between a C-string variable and an array of chars?
A: The string is a sequence of characters.
Q: The Chinese zodiac sign is based on a 12-year cycle, and each year in this cycle is represented by…
A: #include<bits/stdc++.h>using namespace std;int main(){ //array to store animals string…
Q: Write a function that accepts a pointer to a C-string as an argument and returns the number of words…
A: PROGRAM: #include<iostream>using namespace std;int wordCounter(string s){int c=0;for(int…
Q: nt a flow cgart for this program #include using namespace std; class Song { public: string…
A: given data i want a flow cgart for this program #include<bits/stdc++.h> using namespace…
Q: IN JAVA Create a function that takes a string and returns the number of alphanumeric characters that…
A: In this problem, we need to create a function that takes a string and returns the number of…
Q: In Python: Define a function in which a string is passed as a parameter and the function returns…
A: Write a Python program to define a function in which a string is passed as a parameter and the…
Q: What is the output of the following C++ code? vector<int> intList(10);for (int i = 0; i <…
A: PROGRAM: //Adding the required header files #include <iostream> #include <vector>…
Q: Write a program in C++ to compare two integer arrays
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: Hello, I was making a hangman simulation in C++. The code runs, but not fully. Could you identify…
A: C++ Code :- #include<iostream>#include<cstring> // for string class…
Q: Write a pseudo code to find the length of a string without using any library function (e.g,…
A: In this strings are stored as Null character ('\0'), which means it terminate the character array.…
Q: You must use an STL container (such as list or vector) for this assignment; solutions not using an…
A: #include <iostream> #include <cmath> #include<vector> using namespace std; int…
Q: Write C++ Program to perform following string manipulation?
A: a) #include <bits/stdc++.h>using namespace std; void divide(string a){ string name = "";…
What is the output of the following C++ program segment?
string names[] = {"Blair, Cindy", "Johnson, Chris",
"Mann, Sheila"};
string str1, str2;
char ch = ',';
int pos, length;
for (auto &str: names)
{
pos = str.find(ch);
length = str.length();
str1 = str.substr(0, pos);
str2 = str.substr(pos + 2, length - pos - 1);
str = str2 + ' ' + str1;
}
for (auto str: names)
cout << str << endl;
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- I am trying to compile a poker program in c++ and it still doesn't work: main.cpp: #include <iostream>#include <string>#include <fstream>#include <iomanip>#include <sstream> #include "card.h"#include "deck.h"#include "hand.h" using namespace std; /************************************************************* FunctionName ** Function description ** ** *************************************************************/int main(){string repeat = "Y";Deck myDeck;Hand myHand;string exchangeCards; while (repeat == "Y" || repeat == "y"){cout << endl; myHand.newHand(myDeck);myHand.print();cout << endl; cout << "Would you like to exchange any cards? [Y / N]: ";getline(cin, exchangeCards); while (exchangeCards != "Y" && exchangeCards != "y" && exchangeCards != "X" && exchangeCards != "n"){cout << "Please enter Y or N only: ";getline(cin, exchangeCards); } if(exchangeCards == "Y" || exchangeCards ==…in c, Writing a program to make the user able to enter text and then enter a letter he wants to remove from this text. I need to write a C function that deletes the desired character in a given character string. Don't use the library function for string operations. * following this finction void letterDeleted(char str[], chardeleted_letter) { }Consider the following obfuscated and confusing program code below. #include <iostream> using namespace std; int fib(int); int main() { cout << "Enter an index for the Fibonacci number: "; int index; cin >> index; cout << "Fibonacci number at index " << index << " is " << fib(index) << endl; return 0; } int fib(int index) { if (index == 0) return 0; else if (index == 1) return 1; else return fib(index - 1) + fib(index - 2); } Create a C++ Builder Console Project and copy/paste the above code into the .cpp file of the project. Run the project... it should run fine. Now, REFORMAT the code to demonstrate you know Software Engineering principles in making code readable and understandable. FOLLOW the exmples that are given in the textbook and the learning activities. ADD COMMENTS to document what the program/code does. You will be expected to format your code throughout this course using proper indentations and placement of curly braces. STUDY…
- Question 1. Read the below C program and answer the following questions. #include <stdio.h> char read_letter(); void pattern(int rows, int cols, char letter); int main(void) { int rows, cols; char letter; letter = read_letter(); printf("Enter the number of rows: "); scanf("%d",&rows); printf("Enter the number of columns: "); scanf("%d",&cols); pattern(rows, cols, letter); return 0; } char read_letter() { char letter; printf("Enter the first letter of your name: "); scanf("%c",&letter); return letter; } void pattern(int x, int y, char letter) { int i, j; printf("\n"); for (i = 0; i <x; i++) { for (j = 0; j <y; j++) { printf("%3c",letter); } printf("\n"); } return; } List all the functions that have been uses in the code and mention their type. Explain the commands that have been executed by each function. Explain the loop part and explain how to calculate the number of iterations. Run the given…Question 3. Read the below C program and answer the following questions. #include <stdio.h> char read_letter(); void pattern(int rows, int cols, char letter); int main(void) { int rows, cols; char letter; letter = read_letter(); printf("Enter the number of rows: "); scanf("%d",&rows); printf("Enter the number of columns: "); scanf("%d",&cols); pattern(rows, cols, letter); return 0; } char read_letter() { char letter; printf("Enter the first letter of your name: "); scanf("%c",&letter); return letter; } void pattern(int x, int y, char letter) { int i, j; printf("\n"); for (i = 0; i <x; i++) { for (j = 0; j <y; j++) { printf("%3c",letter); } printf("\n"); } return; }You must answer the Problem in C++. (Anagrams) Write a function that checks whether two words are anagrams. Two words are anagrams if they contain the same letters in any order. For example, “silent” and “listen” are anagrams. The header of the function is as follows: bool isAnagram(const string& s1, const string& s2) Write a test program that prompts the user to enter two strings and checks whether they are anagrams. Sample Run 1 Enter a string s1: silent Enter a string s2: listen silent and listen are anagrams Sample Run 2 Enter a string s1: split Enter a string s2: lisp split and lisp are not anagrams
- Please Answer this in C++: Write code to read a list of song durations and song names from input. For each line of input, set the duration and name of currSong. Then add currSong to myPlaylist. Input first receives a song duration, then the name of that song. Use getline() to read in the name. Input example: 424 Time383 Money-1 C++ Code Given: #include <iostream>#include <string>#include <vector>using namespace std; class Song { public: void SetDurationAndName(int songDuration, string songName) { duration = songDuration; name = songName; } void PrintSong() const { cout << duration << " - " << name << endl; } int GetDuration() const { return duration; } string GetName() const { return name; } private: int duration; string name;}; int main() { vector<Song> myPlaylist; Song currSong; int currDuration; string currName; unsigned int i; cin >> currDuration;…In C++, What is wrong with the following code segment? 1. Given the following function to calculate the volume of a box: int boxVolume(int l, int w, int h) { boxVol = (l * w * h); }Implement in C Programming 8.15.1: LAB: Capitalizing vowels #include <stdio.h>#include <stdlib.h>#include <string.h> // Return a newly allocated copy of original// with the first occurrence of each vowel capitalizedchar* CapVowels(char* original) { /* Type your code here. */} int main(void) { char userCaption[50]; char* resultStr; scanf("%s", userCaption); resultStr = CapVowels(userCaption); printf("Original: %s\n", userCaption); printf("Modified: %s\n", resultStr); // Always free dynamically allocated memory when no longer needed free(resultStr); return 0;}
- Write a function in C# that takes in a string as input and returns a new string with all of the vowels removed. The function should be case-insensitive, so both uppercase and lowercase vowels should be removed. The input string will only contain alphabetical characters and spaces. Example: Input: "Hello World!" Output: "Hll Wrd!" Constraints: The input string will have at most length 100. Can you write a C# function that solves this problem? public string RemoveVowels(string s) { // Your code here }In c++, please. Thank you! A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe 123-5432 Linda…*Try to run the program in c++ then answer the questions below* PROGRAM: #include<iostream>#include<iomanip>using namespace std; int main(){int temp [7][2]; int high_temp, low_temp;double total_high = 0.0, total_low = 0.0, avg_high = 0.0, avg_low = 0.0;cout << "\t===========================";cout << "\n\tDay Highest Lowest\n";cout << "\t===========================";cout << endl <<endl;for(int row = 0; row < 7; row += 1){for (int col = 0; col < 2; col += 1){if (col == 0){cout << "\t " << row +1 << "\t";cin >> temp [row][col];}else{cin >> temp [row][col]; }}}cout << "\n\t===========================";cout << endl << "\t";high_temp = temp [0][0];low_temp = temp [0][1];for (int col = 0; col < 2; col ++){for (int row = 0; row < 7; row ++){if ((col == 0) && (temp [row][col] > high_temp))high_temp = temp [row][col];if ((col == 1) && (temp [row][col] <low_temp))low_temp…