complete a working program that converts a given temperature from Fahrenheit to Celsius and vice versa, depending on which option (integer) the user enters.
Revise your temperature converter to use a switch statement. The switch should test a char variable holding the characters entered by the user, e.g: Enter "f" to convert from Fahrenheit to Celsius Enter "c" to convert from Celsius to Fahrenheit
You should provide an appropriate default statement.
it should be a switch statement
Using a switch statement write a program that evaluates a student's mark (0-100) to the respective grade. Grade boundaries are defined below
Less than 40: F
Between 40 and 49: E
Between 50 and 59: D
Between 60 and 69: C
Between 70 and 79: B
Greater or equal to 80: A Your program should ask the user to input the student's full name and mark (between 0 - 100) and then output the student's name and grade (A - F). You should also handle invalid grade values
Print the two strings, firstString and secondString, in alphabetical order. Assume the strings are lowercase. End with newline. Sample output:
Construct a Complex structure to represent a complex number with both real and imaginary components being real numbers. Request:
Write functions that calculate the sum, difference, product, and quotient of two complex numbers
Write a function that calculates the sum and difference of two complex numbers simultaneously.
Write a function that calculates the modulus of a complex number
Write a function that displays a complex number in the correct format (a+bj where a is the real component, b is the imaginary component)
Write C++ program to count the number of objects created and destroyed for a class using
static data members and static member functions.
1. Using C++ Build a class Mobile with the following data members
· Model (string)
· Brand (string)
· Price (float)
· simNum(string)
1. Provide a method print setSimNum(string num) that assigns the value num to the attribute simNum
2. Provide a method getNetwork() that returns a string telling which network operator this sim is registered on e.g. Warid, Jazz, Ufone, ,etc. For this you will have to get the first 4 chacters of the simNum and find out the network. E.g. if these 4 characters are 0300 then you will return “Jazz” , if these are 0333 then you will return Ufone and so on.
2. Using C++ Build a class Date with the following attributes
· Day(int)
· Month(int)
· Year(int)
Provide a method setDate(int d, int mon, int y). Inside this method you will assign the value of d to the day attribute, mon to the month attribute and y to the year attribute.
Provide another method nextDay(). This method will increment the day to the next day but do implement sanity checks. i.e. if the day is already 31 then the next day will be 1 and you will increment month. Similarly if the day is 30 but the month is 4 (April) then the next day will again be 1 and the month will be incremented to 5. Similarly if the date is already 31 of December i.e. day is 31 and month is 12 then the next day will mean that day becomes 1, month also becomes 1 and the year is incremented. So look for all possible situations and implement this method accordingly
Provide a method print that prints the date in the following format 6-10-2021
Defines a function that stores the elements of an array of real numbers in reverse, declaring the function as: void reverse (double arr[], const int size, double*& rev). Write a main program using the above function.
Write a definition of a distance class as shown in the example 4.2 above. Make all the appropriate function constant. Include a constant data member called id of integer type. Create two object constant and non-constant. Assign values and display them. Also check what happens If you try to modify private data member of an object from the definition of const function If you try to modify the private data member of const object from the definition of non-constant function.