Transcription of Arrays in C/C++
{{id}} {{{paragraph}}}
Osethatwewantaprogramthatcanreadinalisto fnumb ersandsortthatlist,or econcreteab outit,supp osewehave15numb erstoreadinfroma ers,butthenhowcouldweusealo optocomparethevariablestoeachother? ,sothatwecouldwritesomethinglikemax = 0;for ( i = 0; i < 15 ; i++ ) {if ( number_i > max )max = number_i ;} ++strings:ifwedeclarestring str;thenwecanwritealo oplikefor ( int i = 0; i < (); i++ )cout < < str[i] < < - ;inwhicheachindividualcharacterinstrisac cessedusingthesubscriptop erator[].
Suppose that we want a program that can read in a list of numbers and sort that list, or nd the largest avlue in that list. oT be concrete about it, suppose we have 15 numbers to read in from a le and sort into ascending order. We could declare 15 ariablesv to store the numbers, but then how could we use a loop to compare the ariablesv to each ...
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}