SlideShare una empresa de Scribd logo
1 de 1
Descargar para leer sin conexión
Question 1 Write a program in C++ that declares two variables, an integer variable named "age"
and a floating-point variable named "height". The program should produce the following output:
Enter your age: 30 Enter your height in meters: 1.75 Your age is 38 and your height is 1.75
meters. (10) Question 2 Write a C++ program that prompts the user to enter a string of text, and
then counts the number of vowels (a,e,i,o,u) in the string. The program should then print the
output as follows if the user enters the "Hello, World!" string: Enter a string of text: Hello,
World! Number of vowels: 3 (10) SECTION B 70 MARKS Question 3 Write a program in C++
that prompts the user to enter the number of sides of a polygon, and then calculates and prints the
name of the polygon based on the number of sides. The program should handle polygons with 3
to 10 sides, and should print an error message if the user enters a number outside of this range.
The output should be displayed as follows:
Question 3 Write a program in C++ that prompts the user to enter the number of sides of a
polygon, and then calculates and prints the name of the polygon based on the number of sides.
The program should handle polygons with 3 to 10 sides, and should print an error message if the
user enters a number outside of this range. The output should be displayed as follows: Enter the
number of sides of the polygon: 5 Pentagon (20) Question 4 Write a program in C++ that
prompts the user to enter a sequence of positive integers, and then calculates and prints the sum
of all odd numbers in the sequence using a while loop. In addition, the program should print out
the minimum and maximum values entered in the sequence using a separate while loop. (20)
Question 5 Write a program that prompts the user to enter two integers and then performs the
following operations on the entered values: Multiplies the two integers together and assigns the
result to a variable product. Subtracts the second integer from the first and assigns the result to a
variable difference. Computes the sum of product and difference, and assigns the result to a
variable sum. Computes the remainder when sum is divided by the second integer entered by the
user, using the modulus operator. If the second integer is zero, output an error message. Finally,
the program should print the values of product, difference, sum, and the remainder of sum
divided by the second integer. The program should use appropriate data types and input/output
statements to ensure that the user can enter any valid integer values. (30)

Más contenido relacionado

Similar a C++ program to calculate properties of polygons and integers

Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newLast7693
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newscottbrownnn
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 manjurkts
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab neweyavagal
 
21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?sukeshsuresh189
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)sukeshsuresh189
 
6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...sukeshsuresh189
 
16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...sukeshsuresh189
 
14: Consider the class below:
14: Consider the class below:14: Consider the class below:
14: Consider the class below:sukeshsuresh189
 
18: Which of the following does not generate an event?
18: Which of the following does not generate an event?18: Which of the following does not generate an event?
18: Which of the following does not generate an event?sukeshsuresh189
 
17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...sukeshsuresh189
 
23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?sukeshsuresh189
 
1: The .class extension on a file means that the file
1:  The .class extension on a file means that the file1:  The .class extension on a file means that the file
1: The .class extension on a file means that the filesukeshsuresh189
 
4: Which of the following is a Scanner method?
4: Which of the following is a Scanner method?4: Which of the following is a Scanner method?
4: Which of the following is a Scanner method?sukeshsuresh189
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)sukeshsuresh189
 
10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.sukeshsuresh189
 
12: When an object is concatenated with a String
12: When an object is concatenated with a String12: When an object is concatenated with a String
12: When an object is concatenated with a Stringsukeshsuresh189
 
22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...sukeshsuresh189
 
8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...sukeshsuresh189
 

Similar a C++ program to calculate properties of polygons and integers (20)

SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)
 
6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...
 
16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...16: Which of the following is the method used to display a dialog box to gath...
16: Which of the following is the method used to display a dialog box to gath...
 
14: Consider the class below:
14: Consider the class below:14: Consider the class below:
14: Consider the class below:
 
18: Which of the following does not generate an event?
18: Which of the following does not generate an event?18: Which of the following does not generate an event?
18: Which of the following does not generate an event?
 
17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...17: provides the basic attributes and behaviors of a window—a title bar at th...
17: provides the basic attributes and behaviors of a window—a title bar at th...
 
23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?23: Which layout manager is the default for JPanel?
23: Which layout manager is the default for JPanel?
 
1: The .class extension on a file means that the file
1:  The .class extension on a file means that the file1:  The .class extension on a file means that the file
1: The .class extension on a file means that the file
 
4: Which of the following is a Scanner method?
4: Which of the following is a Scanner method?4: Which of the following is a Scanner method?
4: Which of the following is a Scanner method?
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)
 
10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.10: In the Java graphics system, coordinate units are measured in ________.
10: In the Java graphics system, coordinate units are measured in ________.
 
12: When an object is concatenated with a String
12: When an object is concatenated with a String12: When an object is concatenated with a String
12: When an object is concatenated with a String
 
22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...22: The logical relationship between radio buttons is maintained by objects o...
22: The logical relationship between radio buttons is maintained by objects o...
 
8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...8: Which statement below could be used to randomly select a state from an arr...
8: Which statement below could be used to randomly select a state from an arr...
 

Más de AlphaVision2

Question content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdfQuestion content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdfAlphaVision2
 
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdfQUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdfAlphaVision2
 
Question-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdfQuestion-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdfAlphaVision2
 
Question Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdfQuestion Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdfAlphaVision2
 
QUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdfQUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdfAlphaVision2
 
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdfRecuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdfAlphaVision2
 
Question 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdfQuestion 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdfAlphaVision2
 
Receiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdfReceiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdfAlphaVision2
 
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdfRecapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdfAlphaVision2
 
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdfRead two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdfAlphaVision2
 
Read the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdfRead the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdfAlphaVision2
 
Read the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdfRead the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdfAlphaVision2
 
Read the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdfRead the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdfAlphaVision2
 
Read Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdfRead Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdfAlphaVision2
 
Rather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdfRather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdfAlphaVision2
 
Question content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdfQuestion content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdfAlphaVision2
 
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdfRavi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdfAlphaVision2
 
Rate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdfRate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdfAlphaVision2
 
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdfRaphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdfAlphaVision2
 
Rank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdfRank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdfAlphaVision2
 

Más de AlphaVision2 (20)

Question content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdfQuestion content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdf
 
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdfQUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
 
Question-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdfQuestion-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdf
 
Question Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdfQuestion Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdf
 
QUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdfQUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdf
 
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdfRecuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
 
Question 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdfQuestion 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdf
 
Receiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdfReceiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdf
 
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdfRecapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
 
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdfRead two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdf
 
Read the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdfRead the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdf
 
Read the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdfRead the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdf
 
Read the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdfRead the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdf
 
Read Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdfRead Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdf
 
Rather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdfRather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdf
 
Question content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdfQuestion content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdf
 
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdfRavi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
 
Rate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdfRate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdf
 
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdfRaphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
 
Rank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdfRank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdf
 

Último

Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...HetalPathak10
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxryandux83rd
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Osopher
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfChristalin Nelson
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineCeline George
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 

Último (20)

Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptx
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
 
Chi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical VariableChi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical Variable
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
CARNAVAL COM MAGIA E EUFORIA _
CARNAVAL COM MAGIA E EUFORIA            _CARNAVAL COM MAGIA E EUFORIA            _
CARNAVAL COM MAGIA E EUFORIA _
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdf
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command Line
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 

C++ program to calculate properties of polygons and integers

  • 1. Question 1 Write a program in C++ that declares two variables, an integer variable named "age" and a floating-point variable named "height". The program should produce the following output: Enter your age: 30 Enter your height in meters: 1.75 Your age is 38 and your height is 1.75 meters. (10) Question 2 Write a C++ program that prompts the user to enter a string of text, and then counts the number of vowels (a,e,i,o,u) in the string. The program should then print the output as follows if the user enters the "Hello, World!" string: Enter a string of text: Hello, World! Number of vowels: 3 (10) SECTION B 70 MARKS Question 3 Write a program in C++ that prompts the user to enter the number of sides of a polygon, and then calculates and prints the name of the polygon based on the number of sides. The program should handle polygons with 3 to 10 sides, and should print an error message if the user enters a number outside of this range. The output should be displayed as follows: Question 3 Write a program in C++ that prompts the user to enter the number of sides of a polygon, and then calculates and prints the name of the polygon based on the number of sides. The program should handle polygons with 3 to 10 sides, and should print an error message if the user enters a number outside of this range. The output should be displayed as follows: Enter the number of sides of the polygon: 5 Pentagon (20) Question 4 Write a program in C++ that prompts the user to enter a sequence of positive integers, and then calculates and prints the sum of all odd numbers in the sequence using a while loop. In addition, the program should print out the minimum and maximum values entered in the sequence using a separate while loop. (20) Question 5 Write a program that prompts the user to enter two integers and then performs the following operations on the entered values: Multiplies the two integers together and assigns the result to a variable product. Subtracts the second integer from the first and assigns the result to a variable difference. Computes the sum of product and difference, and assigns the result to a variable sum. Computes the remainder when sum is divided by the second integer entered by the user, using the modulus operator. If the second integer is zero, output an error message. Finally, the program should print the values of product, difference, sum, and the remainder of sum divided by the second integer. The program should use appropriate data types and input/output statements to ensure that the user can enter any valid integer values. (30)