Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
~2K People Reached
Favorite Forums
Favorite Tags
c++ x 37
Member Avatar for qvyhnl

compute recursively the number of times that sub appears in the string, without the sub strings overlapping. str_count("catcowcat", "cat") returns 2 str_count("catcowcat", "cow") returns 1 str_count("catcowcat", "dog") returns 0 please give me some idea to solve this problem [CODE]int str_count(string str, string sub) { int len = str.length(); int s_len …

Member Avatar for Clinton Portis
0
99
Member Avatar for qvyhnl

compute recursively a new string where adjacent characters that are the same have been reduced to a single character. So "yyzzza" yields "yza". You must not use loops. Here are some more examples: string_clean("yyzzza") returns "yza" string_clean("abbbcdd") returns "abcd" string_clean("Hello") returns "Helo" please give me some suggestion.

Member Avatar for Clinton Portis
0
184
Member Avatar for qvyhnl

Can someone show me how to write a recursive function that count how many time the number 7 occur in an integer. Thanks

Member Avatar for mrnutty
0
97
Member Avatar for qvyhnl

Problem stated: Write the function flip_lines(). Open the input and output files file using the parameters. Return true if both files can be opened and processed, false otherwise. If both files can be opened, write each successive line of output in reverse order. (In other words, switch line 1 and …

Member Avatar for qvyhnl
0
409
Member Avatar for qvyhnl

Problem: Write the program columns that takes three command-line arguments. The first is the file to open, the second, the file to write to, and the third is the number of characters to display on each line. Read the input file, character by character, echoing to the output file, inserting …

Member Avatar for qvyhnl
0
141
Member Avatar for qvyhnl

hi, can someone help me started with how to write a program that remove the comments from an input cpp file? I am not even sure how to declare the function, like what would be the parameters? and if I use ifstream file; file.open("text.cpp") will the program treat that as …

Member Avatar for geojia
0
184
Member Avatar for qvyhnl

Prblem: Implement a base class Account and derived classes Savings and Checking. In the base class,supply member functions deposit(), withdraw(), and print() which prints out the ownerand balance. Create constructors that take a string (for the owner's name) and a double for the initialbalance. All methods should return void. I …

Member Avatar for chiwawa10
0
218
Member Avatar for qvyhnl

Write the function my_strncat(). The function has three parameters: a char * s1, a const char * s2, and an int max, which represents the maximum size of the s1 buffer. Append the characters in s2 to the end of s1. Make sure you have only one '\0' at the …

Member Avatar for qvyhnl
0
97
Member Avatar for qvyhnl

Write the function my_strchr(). The function has two parameters: a const char * s pointing to the first character in a C-style string, and a char c. Return a pointer to the first appearance of c appearing inside s and NULL (0) if c does not appear inside s. Is …

Member Avatar for Ancient Dragon
0
194
Member Avatar for qvyhnl

Write the function my_strncpy(). The function has three parameters: a char * dest, a const char * src, and an int max, which represents the maximum size of the destination buffer. Copy the characters in src to dest, but don't copy more than max-1 characters. Make sure you correctly terminate …

Member Avatar for Ancient Dragon
0
184
Member Avatar for qvyhnl

Write the function my_strrchr(). The function has two parameters: a const char * s pointing to the first character in a C-style string, and a char, c. Return a pointer to the last appearance of c appearing inside s and NULL (0) if c does not appear inside s. is …

Member Avatar for qvyhnl
0
102
Member Avatar for qvyhnl

So i have an original char * s with size of n; Can someone show me how to create another char * p with twice the size of s? and then fill p with 2 copy of s? Thanks.

Member Avatar for qvyhnl
0
100
Member Avatar for qvyhnl

Problem: write a function that returns a pointer to the maximum value of an array of double. I have written the code that return the maximum, but I don't know how to turn it into a pointer and return it =.= [CODE]#include <iostream> #include <string> using namespace std; const double …

Member Avatar for qvyhnl
0
108
Member Avatar for qvyhnl

I had created a Person class with 2 fields ages and name, its member functions are [CODE] Person::Person(string n, int a){ name = n; age = a;} string Person::get_name() const{ return name;} void Person::increment_age(){ age += 1;} void Person::print() const{ cout << name << endl; cout << age << endl;}[/CODE] …

Member Avatar for qvyhnl
0
144