Write a C++ program that prompts a user for three integers- the first denoting a month (1 to 12), the second denoting a day (1 to 31) and the third denoting a year. The output is displayed as "month day, year" string where month represents the name of the month.
For example, if inputs are 12, 15 and 2020 respectively, the output is December 15,
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.
Write a program in C++ that defines a class named StringOps. Declare data members of
this class as described below:
variable str of data type string.
variable size of data type integer which represents the length of the string str.
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