[cs13001] Example exam questions 7 and 8

Dianne Foreback dforebac at kent.edu
Wed Jul 2 17:17:17 EDT 2014


Hello CSI Class,

I received a question for 7 and 8 on the example exam.

For question 8,
http://www.cs.kent.edu/~dforebac/classes/csi.su14/Examples/Structs/arrays.cpp
gives a good example on how to assign values to structure member variables.
 Also, if you took notes in class yesterday, you will have more examples.
 Additionally, the presentation
http://vega.cs.kent.edu/~mikhail/classes/csi.s14/Slides/L15structs.ppt
contains more information.  The link to more structure examples is
http://www.cs.kent.edu/~dforebac/classes/csi.su14/Examples/Structs/

For question 7,
http://www.cs.kent.edu/~dforebac/classes/csi.su14/Examples/Arrays/fixedArray.cpp
provides an example of iterating though an array to find the minimum value.
 To determine if an value exists in the array, the following snipet of code
can be used.

int ar[5];
int valueToFind;
cout << "enter number to find ";
cin>> valueToFind;

bool found = false;
for ( int i=0; i <5; ++i)
   if (ar[i] == valueToFind){
      found = false;
      break;
   }

cout << found;

Kind Regards,
Dianne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://listmail.cs.kent.edu/pipermail/cs13001/attachments/20140702/5aa71397/attachment.html 


More information about the cs13001 mailing list