Write a prototype for the function named fsum() that accepts two parameters: an array A of integer pointers and a variable x of type double. The return type of this function is int. Store three integer values entered as command line arguments in an integer array A. Insert the string “ Offline” after the first occurrence of character „o‟ in the string s1= “Hello World”. Also, print the ASCII value of each character in this modified string after insertion. Define a function replace() that receives an integer number as parameter and replaces it with a number formed by rearranging the digits of the original number. The return type of the function is void. Define a class A that declares a static variable count of type integer. Initialize the value of count to zero. Use the variable count to count the number of objects of the class A
Write a program in C++ that defines a class named Student that represents a student. This
class declares three variables – name, stipend and course of suitable data types. It also has
a variable intern_status that is set to 1 if the student is interning in some organization and
0 otherwise. This variable is initialized appropriately in the constructors of the class. The
member functions of this class should be defined as given below:
Parameterized constructor that initializes the values of all the members.
An overloaded constructor that sets the stipend to zero for a non-interning student.
Copy constructor for the class Student.
Overload Operator << as a friend function in the class Student for displaying the
details of the student.
Destructor for the class Student.
In the main() function, create two objects of this class; one for a ststuden
to create a new object and display it using << operator.
Write a program in C++ that reads text from the keyboard and stores it in a file named
“File1.txt”.
Also, for each of the specified prototypes given below, write the function definitions.
void copyselc(ifstream& fp, ofstream& fp1):This function reads the
contents of the file “File1.txt” and copies those lines from the file that begin with
the character „#‟ to the file named “File2.txt”.
void checksize(ifstream& fp1,ifstream& fp2):This function reads
two files “File1.txt” and “File2.txt” and counts the number of characters in
both the files. If the count of characters in both the files is same, then the function should
print the message “Both Files are of the same size” else it should display
“Size of the files is not same”.
void dispNumNames(ifstream& fp):Assuming that the file “File2.txt”
may also contain numbers (1 to 5), this function will read the contents from the file and
display the number names for any numbers encountered.
Write C++ code for the following tasks:
Write a prototype for the function named fsum() that accepts two parameters: an array
A of integer pointers and a variable x of type double. The return type of this function is
int.
Store three integer values entered as command line arguments in an integer array A.
Insert the string “ Offline” after the first occurrence of character „o‟ in the string
s1= “Hello World”. Also, print the ASCII value of each character in this modified
string after insertion.
Define a function replace() that receives an integer number as parameter and
replaces it with a number formed by rearranging the digits of the original number. The
return type of the function is void.
Define a class A that declares a static variable count of type integer. Initialize the value
of count to zero. Use the variable count to count the number of objects of the class
A
Problem:
Create a Fraction class with two private positive integer member variables numerator and denominator, one
constructor with two integer parameters num and den with default values 0 and 1, one display function that
print out a fraction in the format numerator/denominator in the proper form such as 2/3 or ½ . Note: 2/4
should be displayed as ½.
You've learned in the past lessons on how to use square root functions, right? Then let's take your knowledge to the test. Print out the square root of a given integer with only two decimal places.
Ready, solve, and go!
Input
A line containing an integer.
4
Output
A line containing a decimal with two decimal places.
2.00
what is the pseudocode that will prepare the monthly credit card billing report of a customer. The input will contain the name of the person who has purchased on credit, the previous balance, total purchases and total payments. The output lists the name, interest and new balance.
The amount subject to a finance charge is obtained by adding the total purchases to the previous balance and subtracting the total payments. If the amount subject to a finance charge is $250 or more, interest will be calculated by multiplying this amount by 1.5 percent. Otherwise the interest is calculated as 1 percent of the amount. The new balance is obtained by adding the interest to the amount subject to a finance charge.
In a local government meeting, community leaders are required to identify one SDG, out of the 17 goals, that is most important to local PNG communities. Each community leader is required to select their goal of choice only once. The vote is recorded as a number from 1 to 17. The number of community leaders voting is unknown beforehand, so the votes are terminated by a value of zero (0). Votes not within and not inclusive of the numbers 1 to 17 are invalid (spoilt) votes. A file, sdGoals.txt contains the list of goals. The first goal is listed as SDG 1, the second as SDG 2 and so forth. The goals are followed by the number of votes for the goal.
Write a program to read the data and evaluate the results of the selection. Print all the output to a file called sdgSelection.txt
The program output should specify the total number of votes and the number of invalid votes. This is followed by the votes received for each SDG and the winning (top) selection SDG.
In a local government meeting, community leaders are required to identify one SDG, out of the 17 goals, that is most important to local PNG communities. Each community leader is required to select their goal of choice only once. The vote is recorded as a number from 1 to 17. The number of community leaders voting is unknown beforehand, so the votes are terminated by a value of zero (0). Votes not within and not inclusive of the numbers 1 to 17 are invalid (spoilt) votes. A file, sdGoals.txt contains the list of goals. The first goal is listed as SDG 1, the second as SDG 2 and so forth. The goals are followed by the number of votes for the goal.
Write a program to read the data and evaluate the results of the selection. Print all the output to a file called sdgSelection.txt
The program output should specify the total number of votes and the number of invalid votes. This is followed by the votes received for each SDG and the winning (top) selection SDG.
Create objec-oriented programming that well implement this principle:
"According to plato, a man should marry a woman who is half his age plus 7 years"
Create the following:
1. Two (2) classes (MyMainClass & TheOtherClass)
2. Two (2) mutator methods:
•setName - accepts a man's name then copies that name to the attribute "name"
•setAge - accepts a man's age then copies that age to the attribute "man_age"
3. Two (2) accessor method:
•getName (String) - returns the man name attribute "name"
•getWomanAge(int) - returns the woman's age attribute "woman_age"
Sample output:
Enter the man's name: Hansel
Enter the man's age: 36
Hansel should Mary a girl who's 25 years old.