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 3
Back to IoT Lab A.Y. 2022/23

Written: 2023/03/26

Tags: C++, exercises, lecture 3, arrays, pointers, STL containers

Solutions
Exercise 1
Exercise 2

Summary

Solutions to the exercises proposed at the end of Lecture 3, held on March 21st, 2023.

Solutions

Exercise 1

Write a program that, given two arrays of equal size, uses a function that merges them into a single array having elements from the first and the second one alternating every position (e.g. input: [1,2,3], [7,8,9], output: [1,7,2,8,3,9];Β  hint: function should accept three array parameters, the last one being double the size of the first two).

Exercise 2

Implement the same program of Exercise 1 using STL containers (not necessarily of the same size) and iterators (hint: use vector and pass-by-reference mechanism).

IoT Lab 2022/23

Google Sites
Report abuse
Google Sites
Report abuse