-2

i am new at c++ so plz help me to solve this home work i need marks plz
Q1
This question carries 20% of the marks for this assignment.
Write a complete C program that asks the user to enter continuously a series of words and the
word “end” to stop.
For each word entered, you should output the number of characters of this word and then ask him
to enter the other word.
Finally, when he finished entering all the words, you should output the number of words entered
(excluding “end”)
Q2
This question carries 20% of the marks for this assignment.
Write a complete C program that calculates the roots of any quadratic equation of the form ax2 +
bx + c = 0 where a, b and c are variables that should be entered by user.
First, if a = 0 then the root is x= -c/b
otherwise, you have to find Δ, Δ=b2 – 4ac
If Δ< 0 there are no roots
If Δ= 0 we have 2 double roots: x1 = x2 = -b/2a
If Δ>0, two roots x1 = (-b-√Δ)/2a and (–b +√Δ)/2a
Hint: you can include math library to use some math functions
Q3
This question carries 20% of the marks for this assignment.
i) Write a function isEven that takes a positive number as an attribute, the function checks
if the number is even. The function returns 1 if the number is even and returns -1
otherwise. Here is the prototype of the function:
int is even (int x);
ii) Write a C program that prompts the user to enter a positive number; The program should
call the function named isEven (defined in part i) to check if the number entered is Even
or Odd. After calling the function, a message should be displayed to inform the user that
the number entered is even or odd.
Q4
This question carries 20% of the marks for this assignment.
Write a function with two parameters, the first of type char and the second of type int. The
purpose of the function will be to print out the first parameter the specified number of times (the
second parameter is the number of times). Write a main that calls this function to print a square
formed of any character.
Q5
This question carries 20% of the marks for this assignment.
Write a function called CountMultiplesOfThree that takes as parameters two integers, start and
stop, counts all integers between start and stop (inclusive) that are multiples of 3, and returns
the number of these integers. For example if start is 7 and stop is 10 then the function will
return 1 since only 9 is a multiple of 3.
Do not write a main for this exercise.
Hint: use one of the three repetition structures (loop)

Votes + Comments
homework kiddo
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by mitrmkar
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.