0% found this document useful (0 votes)
18 views11 pages

It Report

Uploaded by

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

It Report

Uploaded by

Shreya Podder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

IT REPORT

DONE BY: Radit Rauf


Grade 12

Submitted to: Anik Sen

“CONTENTS: PAGE 1-9 CODES. PAGE 10-11 EXPLANATIONS”


1) Write a C++ program that takes input in Celsius and converts it to
Fahrenheit. Ensure that the program handles invalid inputs gracefully and
prompts the user to enter a valid temperature.

OUTPUT:

OUTPUT 2:

PAGE: 2
2) Create a C++ program that calculates the average of three subject grades.
Display the corresponding letter grade (A, B, C, etc.) based on the average. Use
conditional statements to handle different grade ranges.

OUTPUT:

PAGE: 3
3) Implement a C++ program that calculates the factorial of a given positive
integer. Use a loop structure to perform the computation. Ensure that the
program handles non-positive inputs gracefully.

OUTPUT:

OUTPUT 2:

PAGE: 4
4) Develop a C++ program that generates a number pattern based on user input. For
example, if the user enters 5, the program should print the following pattern:
1
22
333
4444
55555

OUTPUT 1 OUTPUT 2

PAGE: 5
5) Create a C++ program that generates a random number between 1 and 100 and
asks the user to guess it. Provide feedback to the user if their guess is too high
or too low. Use loop structures to allow the user multiple attempts. Additionally,
incorporate a conditional statement to congratulate the user when they guess
the correct number.

OUTPUT

PAGE: 6
6) Create a C++ program that prints the first n terms of the Fibonacci series,
where n is provided by the user. Ensure that the program handles invalid inputs
gracefully and uses loop structures for series generation.

OUTPUT:

OUTPUT 2:

PAGE: 7
7) Develop a C++ program that acts as a menu-driven calculator. The program
should allow the user to perform addition, subtraction, multiplication, and
division. Use switch statements for the menu.

OUTPUT:

PAGE: 8
8) Implement a C++ program that checks whether a given year is a leap year
or not. Use conditional statements to determine the leap year conditions,
considering that a year is a leap year if it is divisible by 4, except for
years that are divisible by 100 but not by 400.

OUTPUT:

OUTPUT 2:

PAGE: 9
EXPLANATION OF THE CODES:

CODE 1: https://onlinegdb.com/AYPzbtoLi

This C++ program changes temperatures from Celsius to Fahrenheit. It asks the user to type
in a Celsius temperature, and checks if the input is a valid number using the “if (cin >>
celsius)” statement. If it is, it calculates the equivalent Fahrenheit temperature using a
formula. Then, it shows the result. If the input isn't a valid number, it tells the user to enter a
proper temperature. The program finishes by telling the computer everything went okay
(return 0). It's a basic tool to convert temperatures with a way to handle mistakes when users
don't type in a number.

CODE 2: https://onlinegdb.com/FoBzBML5E

This C++ program figures out users' letter grade based on the grades they put in for three
subjects. It asks the user to type in the grades, calculates the average, and then gives an 'A',
'B', 'C', 'D', or 'F' based on that average. If the average is 90 or higher, it gives an 'A'; between
80 and 89, gives a 'B'; between 70 and 79, gives a 'C'; between 60 and 69, gives a 'D'; and
below 60, provides an 'F'. After figuring this out, it states the user's letter grade. It's a simple
program for grading based on averages.

CODE 3: https://onlinegdb.com/LGiznkOLf

This C++ program helps find the factorial of a positive number that the user enters. It asks to
put in a positive number, then it checks if it's not negative. If the user enters a negative
number, it states it should be positive and exits with a return code of 1. Otherwise, it
calculates the factorial using a loop. The factorial is the product of all positive numbers up to
the one entered. After doing the maths, it shows the result. It's a tool to figure out the factorial
of a positive number.

CODE 4: https://onlinegdb.com/yoZ6EimvT

This C++ program makes a pattern of numbers based on what an user enters. It asks to put in
the number of digits wanted in the pattern. If the user puts in a negative number or zero, it
tells them that digits can't be negative. But if a positive number is entered, it creates a pattern
where each row has repeating digits in ascending order. The pattern is formed using nested
loops. It's a program that generates a simple number pattern based on input.

PAGE: 10
CODE 5: https://onlinegdb.com/7-ARYhf-K

This C++ program is a guessing game. The computer picks a random number between 1 and
100 using the ‘rand()’, and the user has to try and guess it. It tells if the guess is too high or
too low after each attempt. The game keeps going until they correctly guess the number. It
keeps track of how many tries it takes to get it right. Once the correct number is guessed, it
shows how many attempts were needed. The ‘srand(static_cast<unsigned int>(time(0)))’ line
is used to seed the random number generator based on the current time, ensuring a different
random number is generated in each run of the program. Basically, it's a fun little game to try
to figure out the secret number the computer picked.

CODE 6: https://onlinegdb.com/lnbB7HIN1

This C++ program creates the Fibonacci series based on the number of terms the user
chooses. It asks to enter how many terms they want, and if they put in a non-positive number,
it says you need to enter a positive number and exit with a return code of 1. If they enter a
positive number, it then generates the Fibonacci series up to that number of terms and shows
it. The Fibonacci series starts with 0 and 1, and each subsequent number is the sum of the two
before it. It's a program to make and display the Fibonacci series based on the input.

CODE 7: https://onlinegdb.com/G7HxjqN2O

This C++ program is like a simple calculator. It shows a menu with options for addition,
subtraction, multiplication, and division. The user picks an operation by entering a number
from 1 to 4. After that, it asks for two numbers. Based on the operation they chose, it adds,
subtracts, multiplies, or divides these numbers. However, if they try to divide by zero, it tells
them that it's not allowed. Nevertheless, at the beginning, if they enter a number other than 1
to 4, it asks to choose a number from 1 to 4. It's a basic calculator program with a menu for
performing different maths operations.

CODE 8: https://onlinegdb.com/8Uzml4kA0

This C++ program checks if a given year is a leap year or not. It asks the user to type in a
year, then it figures out if that year meets certain rules. If the year is divisible by 4 but not by
100 (unless it's also divisible by 400), it says it's a leap year. Otherwise, it states it's not a leap
year. So, it's a little tool to determine whether a specific year is a leap year or not.

PAGE: 11

You might also like