SlideShare a Scribd company logo
1 of 1
Exercises: 
1. Write a program asking the user for five integers (Don't use arrays!). The program 
then outputs the sum of squares. 
a) Learn how you can start a C++ program from the Windows/Mac OS console, i.e. 
without the IDE (i.e. without Visual Studio or Xcode)! - Document clearly how it 
works! - Your knowledge about using the console should help you. 
b) A menu should be implemented with following options: [input numbers], 
[calculate sum of squares] and [quit]. All options (except [quit]) return to the 
menu after their action has taken place. Erroneous user inputs (e.g. text instead 
of an integer) should be checked by the program and require new input from the 
user. 
Remarks: 
• Everything that was left unspecified can be solved as you prefer. 
• The usage of goto, C++11 extensions, as well as #pragmas is not allowed. The 
usage of global variables is not allowed. You mustn't use the STL (e.g. std::string), 
but std::cout, std::cin and belonging to manipulators can be used. You mustn't use 
new and delete! 
• Avoid magic numbers and use constants where possible. 
• The results of the programming exercises need to be runnable applications! All 
programs have to be implemented as console programs. 
• The programs need to be robust, i.e. they should cope with erroneous input from 
the user. 
• You should be able to describe your programs after implementation. Comments are 
mandatory. 
• In documentations as well as in comments, strings or user interfaces make correct 
use of language (spelling and grammar)! 
• Don't send binary files (e.g. the contents of debug/release folders) with your 
solutions! Do only send source and project files. 
• Don't panic: In programming multiple solutions are possible. 
• If you have problems use the Visual Studio help (F1) or the Xcode help, books and 
the internet primarily. 
• Of course you can also ask colleagues; but it is of course always better, if you find a 
solution yourself.

More Related Content

Viewers also liked

伏犧先天八卦圖
伏犧先天八卦圖伏犧先天八卦圖
伏犧先天八卦圖
a5589389
 
alimentos nutritivos
alimentos nutritivos alimentos nutritivos
alimentos nutritivos
mylavendi
 
Lisosomas
LisosomasLisosomas
Lisosomas
A M
 
Trabajo practico numero 4
Trabajo practico numero 4Trabajo practico numero 4
Trabajo practico numero 4
Fabrizio Grasso
 
Tarta de quesos
Tarta de quesosTarta de quesos
Tarta de quesos
cocinetas
 
Evolución de los modos y medios de transporte
Evolución de los modos y medios de transporteEvolución de los modos y medios de transporte
Evolución de los modos y medios de transporte
6523287
 
Comenuis eco pals questionnary for parents Belgium Ecole Léon Maistriau
Comenuis eco pals questionnary for parents Belgium Ecole Léon MaistriauComenuis eco pals questionnary for parents Belgium Ecole Léon Maistriau
Comenuis eco pals questionnary for parents Belgium Ecole Léon Maistriau
superjo1
 

Viewers also liked (20)

Unidad 2
Unidad 2Unidad 2
Unidad 2
 
Excel Avanzado Y Macros 2007
Excel Avanzado Y Macros 2007Excel Avanzado Y Macros 2007
Excel Avanzado Y Macros 2007
 
伏犧先天八卦圖
伏犧先天八卦圖伏犧先天八卦圖
伏犧先天八卦圖
 
Unidad 1.0
Unidad 1.0Unidad 1.0
Unidad 1.0
 
alimentos nutritivos
alimentos nutritivos alimentos nutritivos
alimentos nutritivos
 
Lisosomas
LisosomasLisosomas
Lisosomas
 
Trabajo practico numero 4
Trabajo practico numero 4Trabajo practico numero 4
Trabajo practico numero 4
 
Tarta de quesos
Tarta de quesosTarta de quesos
Tarta de quesos
 
Tugas so 2 defy ansar
Tugas so 2 defy ansarTugas so 2 defy ansar
Tugas so 2 defy ansar
 
Evolución de los modos y medios de transporte
Evolución de los modos y medios de transporteEvolución de los modos y medios de transporte
Evolución de los modos y medios de transporte
 
Shane Essay
Shane EssayShane Essay
Shane Essay
 
Are your market messages hurting sales
Are your market messages hurting salesAre your market messages hurting sales
Are your market messages hurting sales
 
Bacterias
BacteriasBacterias
Bacterias
 
Comenuis eco pals questionnary for parents Belgium Ecole Léon Maistriau
Comenuis eco pals questionnary for parents Belgium Ecole Léon MaistriauComenuis eco pals questionnary for parents Belgium Ecole Léon Maistriau
Comenuis eco pals questionnary for parents Belgium Ecole Léon Maistriau
 
INDIA IS A RICH COUNTRY EVIDENCED BY POOR POPULATION
INDIA IS A RICH COUNTRY EVIDENCED BY POOR POPULATIONINDIA IS A RICH COUNTRY EVIDENCED BY POOR POPULATION
INDIA IS A RICH COUNTRY EVIDENCED BY POOR POPULATION
 
Deunamujerparalasmujeres
 Deunamujerparalasmujeres Deunamujerparalasmujeres
Deunamujerparalasmujeres
 
prueba final
prueba finalprueba final
prueba final
 
04水的故事
04水的故事04水的故事
04水的故事
 
Diapositiva 1
Diapositiva 1Diapositiva 1
Diapositiva 1
 
Fatla investigacion modificado
Fatla investigacion modificadoFatla investigacion modificado
Fatla investigacion modificado
 

Similar to (2) cpp imperative programming_exercises

L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
MMRF2
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01
Getachew Ganfur
 

Similar to (2) cpp imperative programming_exercises (20)

(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocks
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it security
 
Types of errors 2019
Types of errors 2019Types of errors 2019
Types of errors 2019
 
Programming using C++ - slides.pptx
Programming using C++ - slides.pptxProgramming using C++ - slides.pptx
Programming using C++ - slides.pptx
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
Unit 1 program development cycle
Unit 1 program development cycleUnit 1 program development cycle
Unit 1 program development cycle
 
Autotools, Design Patterns and more
Autotools, Design Patterns and moreAutotools, Design Patterns and more
Autotools, Design Patterns and more
 
C++ for hackers
C++ for hackersC++ for hackers
C++ for hackers
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Week10 final
Week10 finalWeek10 final
Week10 final
 
Sample Project using design patterns and agile
Sample Project using design patterns and agileSample Project using design patterns and agile
Sample Project using design patterns and agile
 
Computer programing 111 lecture 2
Computer programing 111 lecture 2Computer programing 111 lecture 2
Computer programing 111 lecture 2
 
Cp 111 lecture 2
Cp 111 lecture 2Cp 111 lecture 2
Cp 111 lecture 2
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
Synapseindia dot net development computer programming
Synapseindia dot net development  computer programmingSynapseindia dot net development  computer programming
Synapseindia dot net development computer programming
 
Programming of c++
Programming of c++Programming of c++
Programming of c++
 
CHAPTER-1.ppt
CHAPTER-1.pptCHAPTER-1.ppt
CHAPTER-1.ppt
 

More from Nico Ludwig

New c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_ivNew c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_iv
Nico Ludwig
 

More from Nico Ludwig (20)

Grundkurs fuer excel_part_v
Grundkurs fuer excel_part_vGrundkurs fuer excel_part_v
Grundkurs fuer excel_part_v
 
Grundkurs fuer excel_part_iv
Grundkurs fuer excel_part_ivGrundkurs fuer excel_part_iv
Grundkurs fuer excel_part_iv
 
Grundkurs fuer excel_part_iii
Grundkurs fuer excel_part_iiiGrundkurs fuer excel_part_iii
Grundkurs fuer excel_part_iii
 
Grundkurs fuer excel_part_ii
Grundkurs fuer excel_part_iiGrundkurs fuer excel_part_ii
Grundkurs fuer excel_part_ii
 
Grundkurs fuer excel_part_i
Grundkurs fuer excel_part_iGrundkurs fuer excel_part_i
Grundkurs fuer excel_part_i
 
(2) gui drawing
(2) gui drawing(2) gui drawing
(2) gui drawing
 
(2) gui drawing
(2) gui drawing(2) gui drawing
(2) gui drawing
 
(1) gui history_of_interactivity
(1) gui history_of_interactivity(1) gui history_of_interactivity
(1) gui history_of_interactivity
 
(1) gui history_of_interactivity
(1) gui history_of_interactivity(1) gui history_of_interactivity
(1) gui history_of_interactivity
 
New c sharp4_features_part_vi
New c sharp4_features_part_viNew c sharp4_features_part_vi
New c sharp4_features_part_vi
 
New c sharp4_features_part_v
New c sharp4_features_part_vNew c sharp4_features_part_v
New c sharp4_features_part_v
 
New c sharp4_features_part_iv
New c sharp4_features_part_ivNew c sharp4_features_part_iv
New c sharp4_features_part_iv
 
New c sharp4_features_part_iii
New c sharp4_features_part_iiiNew c sharp4_features_part_iii
New c sharp4_features_part_iii
 
New c sharp4_features_part_ii
New c sharp4_features_part_iiNew c sharp4_features_part_ii
New c sharp4_features_part_ii
 
New c sharp4_features_part_i
New c sharp4_features_part_iNew c sharp4_features_part_i
New c sharp4_features_part_i
 
New c sharp3_features_(linq)_part_v
New c sharp3_features_(linq)_part_vNew c sharp3_features_(linq)_part_v
New c sharp3_features_(linq)_part_v
 
New c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_ivNew c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_iv
 
New c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_ivNew c sharp3_features_(linq)_part_iv
New c sharp3_features_(linq)_part_iv
 
New c sharp3_features_(linq)_part_iii
New c sharp3_features_(linq)_part_iiiNew c sharp3_features_(linq)_part_iii
New c sharp3_features_(linq)_part_iii
 
New c sharp3_features_(linq)_part_ii
New c sharp3_features_(linq)_part_iiNew c sharp3_features_(linq)_part_ii
New c sharp3_features_(linq)_part_ii
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

(2) cpp imperative programming_exercises

  • 1. Exercises: 1. Write a program asking the user for five integers (Don't use arrays!). The program then outputs the sum of squares. a) Learn how you can start a C++ program from the Windows/Mac OS console, i.e. without the IDE (i.e. without Visual Studio or Xcode)! - Document clearly how it works! - Your knowledge about using the console should help you. b) A menu should be implemented with following options: [input numbers], [calculate sum of squares] and [quit]. All options (except [quit]) return to the menu after their action has taken place. Erroneous user inputs (e.g. text instead of an integer) should be checked by the program and require new input from the user. Remarks: • Everything that was left unspecified can be solved as you prefer. • The usage of goto, C++11 extensions, as well as #pragmas is not allowed. The usage of global variables is not allowed. You mustn't use the STL (e.g. std::string), but std::cout, std::cin and belonging to manipulators can be used. You mustn't use new and delete! • Avoid magic numbers and use constants where possible. • The results of the programming exercises need to be runnable applications! All programs have to be implemented as console programs. • The programs need to be robust, i.e. they should cope with erroneous input from the user. • You should be able to describe your programs after implementation. Comments are mandatory. • In documentations as well as in comments, strings or user interfaces make correct use of language (spelling and grammar)! • Don't send binary files (e.g. the contents of debug/release folders) with your solutions! Do only send source and project files. • Don't panic: In programming multiple solutions are possible. • If you have problems use the Visual Studio help (F1) or the Xcode help, books and the internet primarily. • Of course you can also ask colleagues; but it is of course always better, if you find a solution yourself.