0% found this document useful (0 votes)
27 views3 pages

Final C

Uploaded by

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

Final C

Uploaded by

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

Activity: Understand the given question and run

to see the output of each program.

1. Create a program that will print "Hello World!" and return 0 to


indicate successful execution.
2. Create a program that will print std::cout to the console.
3. Create a program using insert the new line, and use the \n
character.
4. Create a variable called myNum of type int and assign it the value
15.
5. Run the program using the C++ Identifiers code.
6. What will be the input of this program?
Age: 25
Height: 5.9
Grade: A
Graduated: true
7. Write a C++ program that declares three Boolean variables:
isRaining
isWeekend
isHoliday
8. Write a program that asks the user for two integer inputs. The
program should: Boolean Expressions in Conditional Statements
Check if both integers are positive.
Check if at least one integer is even.
Use Boolean expressions to check these conditions and output the
appropriate messages.
9. Character Input and Output
Write a C++ program that:
Prompts the user to enter a single character.
Displays the ASCII value of the character.
Checks if the character is a letter, a digit, or a special character.
10. Character Case Conversion
Write a program that takes a lowercase letter as input and
converts it to its uppercase equivalent (and vice versa). If the
input is not a letter, the program should display an error message.
 Use cin to take character input.
 Use islower() and isupper() to check the case of the
character.
 Use toupper() and tolower() to convert the case.
11. Character Comparisons
Write a program that compares two characters entered by the
user. The program should:
 Check if the two characters are the same.
 If they are letters, check if they are equal regardless of case
(case-insensitive comparison).
12. Basic String Operations
Write a C++ program that performs the following operations on
two strings entered by the user:
 Concatenates the two strings and displays the result.
 Finds and displays the length of each string.
 Compares the two strings to check if they are equal or not.
13. String Manipulation - Case Conversion
Write a program that:

 Takes a string as input from the user.


 Converts all the characters of the string to uppercase.
 Converts all the characters of the string to lowercase.
Reverses the string.
Instructions:

 Use a loop to convert each character using toupper() and


tolower().
 Use the .rbegin() and .rend() methods to reverse the string.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy