Search this site
Embedded Files
Emanuele Giona
  • Home
  • Research and activities
    • Publications
    • Blog
    • Teaching
  • About me
    • Curriculum Vitae
  • 🔗 LinkedIn
  • 🔗 GitHub
  • 🔗 Twitter
  • 🔗 ORCiD
Emanuele Giona
  • Home
  • Research and activities
    • Publications
    • Blog
    • Teaching
  • About me
    • Curriculum Vitae
  • 🔗 LinkedIn
  • 🔗 GitHub
  • 🔗 Twitter
  • 🔗 ORCiD
  • More
    • Home
    • Research and activities
      • Publications
      • Blog
      • Teaching
    • About me
      • Curriculum Vitae
    • 🔗 LinkedIn
    • 🔗 GitHub
    • 🔗 Twitter
    • 🔗 ORCiD

Lecture 2
Back to IoT Lab A.Y. 2021/22

Written: 2022/03/17

Tags: C++, exercises, lecture 2, operators, flow control, functions

Solutions
Exercise 1
Exercise 2
Exercise 3

Summary

Solutions to the exercises proposed at the end of Lecture 2, held on March 18th, 2022.

Solutions

Exercise 1

Write a program that prompts the user to insert an integer value and sums its digits, printing them at the end (e.g. for a provided integer value of 76, the result should be 13).

Exercise 2

Write a program that includes a function that swaps the contents of two float variables, printing the two variables before and after function invocation (hint: function should return void).

Exercise 3

Implement the for loop, without using while or do while loops, only using if and goto statements.

Revisited solution to more accuretely depict for loop execution.

IoT Lab 2021/22

Google Sites
Report abuse
Google Sites
Report abuse