0% found this document useful (0 votes)
9 views8 pages

C++ Worksheet

The document provides a comprehensive list of programming tasks and exercises to be implemented in C++. These tasks cover a wide range of topics including arithmetic operations, data type conversions, control structures, functions, and mathematical computations. Each task is designed to enhance programming skills and understanding of C++ concepts.

Uploaded by

stotaw abe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

C++ Worksheet

The document provides a comprehensive list of programming tasks and exercises to be implemented in C++. These tasks cover a wide range of topics including arithmetic operations, data type conversions, control structures, functions, and mathematical computations. Each task is designed to enhance programming skills and understanding of C++ concepts.

Uploaded by

stotaw abe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 8
5117122, 11:19 AM study viewer 1.0. find the area of a triangle, A, having base and height as b and h respectively as a floating data types of inputs. 2.0 write a c++ program that converts a temperature value accepted from the user in degree celcious in to faharanite scale. Hint F C32 3.0 A C++ program that runs as an arithmetic operation on two inputs as x and y from the key board as integers and performs to the followings Addition. Subtraction, Multiplication. Division. ‘Modulus (Remainder) of the division. vyvvyvy 4.0.4 C++ program that manipulate on the logical operation of two inputs given from the key board as integer data types and operate as: # Bitwise Logical AND operation. # Bitwise Logical OR operation, Bitwise Logical_XOR operation 5.0 write a program to execute the following structure to you. YOKKXK x XXXX x XXXXXK 6.0 Assuming there is 7.481 gallons in cubic foot write a program that asks the user to enter a number of gallons and display the equivalent in cubic feet. 7.0 write a program that generates the following table. 1990 135 1991 7290 1992 11300 1993 16200 8 write a program that generates the following output using 10 as initial input and recommended operators. 10 20 19 Hint Use an integer constant for the 10, as arithmetic assignment operator to generate 20, and decrement operator to generate 19. hitps:istudylib.netidoc!25200844) 18 5117122, 11:19 AM study viewer 9.0 Ona certain day the British pound was equivalent to $1.487 us dollar, the French franc was $ 0.172, the German Dutch was $ 0.584 and Japanese yen was § 0.00955.Write a program that allows the user to enter amount in dollar and display this value converted to these four monetary units. 10 Write a program that assigns value of 5 for both variable, a and b post and pre increment the variables and assign them for variables d and e: ie. Initialize as, ett; Display the result of a,b, d and e. Repeat the above for decrement operator for post and pre cases: 11 Accept an alphabetical character from the key board and convert (cast) it to equivalent ASCH value. 12 Accept a number from the key board and find its square root as a double data type. 13 write a program that solves two simultaneous equations having inputs from the key board as the following type: axtby=el; extdy=e2; Note: a, b, el, c, dand e? are the inputs and solve for x and y 14-A program that accepts the coefficients of quadratic equation as double data type and calculate roots as rl and 12. 15 write a c++ code that accepts the mark of a student and points out his /her score of grade as the grading system is shown below. 90s100 and comment them as nrvalid mputs). 16 write c+ code to find the maximum of 3 inputs a, b, and ¢ from the key board as integer data types, 17 write a c++ code to find Fibonacci series having the following structure and the maximum range is M. Fibonacci series 1 123 5 8 13 2M ssessnssseeernnreeernMe 18 Write a program in c+ to accept a single character from the keyboard and using cout display the character or key stroke and its decimal, hexadecimal and octal values . Hint -use the set base manipulator for the conversion of the base values and your display has to be in the following way. Character decimal hexadecimal octal 19 accept two numbers from the keyboard and check whether one is @ multiple of the other or not. 20 write a c++program that accepts a 4 digit number from the user and finds the reverse of the digits 21 using simple If..elve structure find the maximum of two numbers accepted from the keyboard, 22 write nested if.else_ program to find the maximum of three inputs from the user 23. using switch statement find the month of the year depending on the number given from keyboard Note: use September as your initial month. 241 we a.c++ program using for loop that displays your name three times. 25 Write a c+ program that finds the sum and average of any numbers you have from the key board using for loop, hitps:istudylib.netidoc!25200844) 218 5117122, 11:19 AM study viewer 26 Using the for loop structure generate the following shape of output a) b) Rew fone aun 3 3 34 44 27 write a c++ program that finds the cube of natural numbers less than 11 The output of vour pattern should be in the following format. 1 8 10 1000 28 Using while loop write a c++ program that displays the first 20 odd numbers starting from 1 da 27. n 29. Using while loop find the sum and average of numbers accepted from the user. 30 Repeat the above using do.....while loop. 31 Using the continue statement write a + program that finds the sum of only positive numbers from the keyboard just leaving the negatives. 32 write a c++ program in a continue statement to add only odd numbers less than 100, 33 write a ¢++ program to have the following pattern as an output Hint: use the comimue statement with for loop 1 12 1234 123456 34 using the break control statement write a c++ program that finds the sum of only 10 positive integers .if zero or negative is encounter display error or negative value is encounter. 35 write a c++program using goto which checks the possible negative or zero value of input data whenever it is non zero or positive , it continues the while loop otherwise it displays a or zero is given. input data error or negative value hitps:istudylib.netidoc!25200844) 38 5117122, 11:19 AM study viewer 36 write a c++program that finds and prints the numbers, squares and cubes using for, while and do....while loop statements. Note: the output should lite; Number Square Cube 37 Write a program in c+ to find the sum of the following series using i) for loop ii) while loop iii) do...while loop iv) continue control statement Vv) goto control statement a) Sum BY SUM=T+34S + ose csene ee AM co) Sum: 38 write a c++ program to read positive number n and to generate the following series using. i) for loop ii) while loop 0246 ©) Number= 13 57 an 4) Number=1 22 3? 42 wi e) Number=1 2? 3? 4? 52 oe 39 using a function call display the output “This is my first program *. 40 write a c++ program that finds the sum of two real numbers using function call 41 develop a c+#code to work on the four arithmetic operations, Addition, Subtraction Division and Multiptication over {wo inputs from the keyboard using function call Hint: you can use function names as adder( ),subtracter( ),divi() and Mult() as identifiers respectively hitps:istudylib.netidoc!25200844) a8 5117122, 11:19 AM study viewer 42 Using function call write a e+ program that finds the sum of the following series of numbers @ Sum = 1+2+3+4+...... +100; b) Sum = 1+3+5+7+. +99; c) Sum = 142? + 37+ 474 574.0... tn? decide n by yourself 43 Write a c++ program to find the factorial of a given number m using function call, 44 using function call develop a c++ program that can find the minimum of the three input numbers from the user (keyboard), 45 Develop a c++ code usit unction that finds the roots of a quadratic equation having the coefficients from you. Note: consider all te conditions and it should support to find the complex roots too. 46 using function calling write a c++ program to find the square root of a number you have from the keyboard 47 Write a c++ program that finds the grade of the student using function call if the grading conditions are as follows; POMAKSLOD. so end SSSmarks59... 5; 70Smarks84... a ‘mavh69, D; o8 No task just good bye hitps:studyib.netidoc!25200844) 718 5117122, 11:19 AM study viewer 66 If linear interpolation is used to approximate a certain data and all the given data are supposed to be approximated by a linear regression curve of least error square estimation method defined as y-ax+b, then write a C++ code for any number of data that best fits a linear equation defined above. If for m number of sampled data is fed in paired xi and yi, (si, yi). Where a and b are evaluated as shown below Re) ER) ~S)- 67 Use fimetion call that accepts any time in seconds and convert it to standard time format HE:MM:SS (hour: minutes: Seconds) 68 Use function call to execute the binomial coefficients of the binomial expansion given below. oP ee spt n(n 1) (ota at + nah Dye ay , MOY) a a ) hitps:istudylib.netidoc!25200844) a8

You might also like