Hands-on 3b

Collections

Program values

  • Inspect, compile and run the program values.cxx.

  • Modify the program (add the code) so that it will look for the minimal and maximal value in the vector and display them.

  • Hints:

    • Define two double variables, one for the minimal and one for the maximal value and initialize them with the value of the first element in the vector
    • Loop over all elements in the vector and update the defined variables if the current value is lower than the variables for the minimal values or greater than the variable for the maximal value
    • After the loop is finished you can print the found values

Program mailing_list

Write a new program, mailing_list.cxx, which will process the list of mail addresses below, find the shortest and longest mail address and display them.

romain.bertonazzi@u-psud.fr
camilo.cordero-ramirez@u-psud.fr
louis-henri.fernandez@u-psud.fr
dahbia.gaci@u-psud.fr
sandra.gyasi@u-psud.fr
md-ariful.islam@u-psud.fr
etienne.kukielczynski@u-psud.fr
yuming.ma@u-psud.fr
jiapeng.ma@u-psud.fr
joseph.nemer@u-psud.fr
yannick.popovitch@u-psud.fr
yuxue.shang@u-psud.fr
sabrina.abrouche@u-psud.fr
orxan.akbarov@u-psud.fr
cansu.bozel@u-psud.fr
malo.diennet@u-psud.fr
german.garzon-losik@u-psud.fr
julie.goyet@u-psud.fr
amanda.miels-de-sousa@u-psud.fr
vinicius.oliveira-cavalcanti@u-psud.fr
akhilesh-harendra.shrotre@u-psud.fr
nohaiza.ul-hassan-shah@u-psud.fr

Hints: Get inspired with the program values.cxx and

  • Change the type of the vector elements in string and fill the mail addresses as strings
  • Define size_t variables for the shortest and longest length values and string variables for the shortest and longest mail address