Sie sind auf Seite 1von 9

Version 1

Individual Report
Note: Your report should contain 500-750 words supported with appropriate references using Coventry University arvard !eference "tyle and include the following: evidence of your wor# re$uired %y the a%ove assess&ent reflection of your wor#' s#ills and #nowledge ac$uired' pro%le&s encountered and how the pro%le&s are resolved

Programming Area: inputs Evidence: (include )iostrea&* using na&espace std+ int &ain,. int age+ //as# user to input age cout )) 01nter your age0 )) endl+ //recieve the input and assign to the varia%le age cin ** age+ //display the age the user entered to chec# cout )) 0You 1ntered:0 )) age )) endl+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 3n this piece of code 3 learnt how to as# for a user to input an option' in this case their age4 5his is done with the std::cin co&&and4

@Coventry University

Page 1

Version 1

Programming Area: outputs Evidence: Full C++ code ,including co&&ents(include )iostrea&* using na&espace std+ int &ain,. //output 7 ello 8orld9 cout )) 0 ello world:0 )) endl+ return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 3n this piece of code 3 used a std::cout to output the standard ; ello 8orld; to the console4

@Coventry University

Page 6

Version 1

Programming Area: data types Evidence: Full C++ code ,including co&&ents(include )iostrea&* using na&espace std+ int &ain ,. // =eclare various varia%les of each data type char letter+ letter > ;?;+ int nu&%er+ nu&%er > 100+ float deci&al > 745+ dou%le pi > <41<15@+ %ool is5rue > false+ // Autput the value of each data type4 cout )) 0char letter:0 )) letter )) endl+ cout )) 03nt Nu&%er:0 )) nu&%er )) endl+ cout )) 0Bloat deci&al:0 )) deci&al )) endl+ cout )) 0=ou%le Ci:0 )) pi )) endl+ cout )) 0%ool is5rue:0 )) is5rue )) endl+ return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 3n this progra& it;s only function is to display a value for each data type4 1ach data type is assigned a value and then that value is %eing outputted4

@Coventry University

Page <

Version 1

Programming Area: varia%le Evidence: Full C++ code ,including co&&ents(include )string* (include )iostrea&* using na&espace std+ int &ain,. //=eclare different types of varia%les string t > 05rue0+ string f > 0Balse0+ unsigned int unsigned3nt > D6@D@E76@5+ signed int signed3nt > -61D7DF<EDF+ int 3nt > 61D7DF<EDF+ short int short3nt > -<67EF+ unsigned int unsigned3nt6 > 0+ int answer+ //Cerfor& a logical test on the varia%les answer > ,,unsigned3nt * signed3nt- GG ,3nt ) ,short3nt HH unsigned3nt6---+ //Autput the 5rue or Balse depending on the answer if ,answer >> 1. cout )) t )) endl+ 2 else . cout )) f )) endl+ 2 return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 3n this progra& 3 assigned different values to all the types of integer varia%les4 ?s an eItra 3 perfor&ed a logical test on the different values to deter&ine the truth of a state&ent4

@Coventry University

Page D

Version 1

Programming Area: assign&ent Evidence: Full C++ code ,including co&&ents(include )iostrea&* (include )string* using na&espace std+ int &ain ,. //declare a varia%le for each na&e and the height array string na&e1+ string na&e6+ string na&e<+ string na&eD+ string na&e5+ float average > 0+ float heightJ5K+ float &aI > heightJ0K+ float &in > heightJ0K+ //as# for each user to enter their na&e and then height and assign it to the correct varia%les cout )) 01nter Na&e of Cerson 1:0+ cin ** na&e1+ cout )) 01nter eight of Cerson 1: 0+ cin ** heightJ0K+ cout )) 01nter Na&e of Cerson 6: 0+ cin ** na&e6+ cout )) 01nter eight of Cerson 6: 0+ cin ** heightJ1K+ cout )) 01nter Na&e of Cerson <: 0+ cin ** na&e<+ cout )) 01nter eight of Cerson <: 0+ cin ** heightJ6K+ cout )) 01nter Na&e of Cerson D: 0+ cin ** na&eD+ cout )) 01nter eight of Cerson D: 0+ cin ** heightJ<K+ cout )) 01nter Na&e of Cerson 5: 0+ cin ** na&e5+ cout )) 01nter eight of Cerson 5: 0+ cin ** heightJDK+ return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 5his progra& as#s for 5 users to input their height and na&e4 5hese values then get assigned to a varia%le for each person4 5his then gets outputted at the end4 5his was easy to do however ta#es a lot of space4 5his could %e reduced %y using &ore arrays4

@Coventry University

Page 5

Version 1

Programming Area: arith&etic operation Evidence: Full C++ code ,including co&&ents(include )iostrea&* using na&espace std+ int &ain,. //=eclare two values and all the results int nu&1 > 10+ int nu&6>5+ int add+ int su%tract+ int divide+ int &ultiply+ int &odulus+ //Cerfor& each calculation add > nu&1Lnu&6+ su%tract > nu&1-nu&6+ divide > nu&1/nu&6+ &ultiply > nu&1Mnu&6+ &odulus > nu&1Nnu&6+ //Autput the results of each calculation cout )) 010 L 5> 0 )) add )) endl+ cout )) 010 - 5> 0 )) su%tract )) endl+ cout )) 010 / 5> 0 )) divide )) endl+ cout )) 010 M 5> 0 )) &ultiply )) endl+ cout )) 010 N 5> 0 )) &odulus )) endl+ return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 3 &ade this progra& to de&onstrate the use of all the asth&atic operators ,addition' su%traction' division' &ultiplication and &odulus-4 3t uses two pre defined values and perfor&s a calculation of each type on the&' outputting the result4 3 had no pro%le&s with this4

@Coventry University

Page E

Version 1

Programming Area: operators ,Ooolean' e$uality' logicalEvidence: Full C++ code ,including co&&ents(include )iostrea&* using na&espace std+ int &ain ,. //?ssign different varia%les of each integer type unsigned int un"igned > D6@D@E76@5+ signed int signed3nt > 61D7DF<ED7+ int &in3nt > 0+ short int short3nt > -<67EF+ unsigned int unsigned3nt > 0+ //Cerfor& a logical test4 cout )) ,,un"igned * signed3nt- GG ,&in3nt ) ,short3nt HH unsigned3nt --- )) endl+ return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 5his progra& perfor&s a logical test on a series of different intergers fro& a state&ent4 3t uses and ,GG- and Ar ,HH- in this case %ut you could also use Not ,:- however this was not re$uired in this case4 5he difficulty in this case was #nowing whether the answer was correct or not4 5his return 1' which in CLL &eans true4 5he only way to chec# this was to go through the e$uation and chec# it yourself using the values4

@Coventry University

Page 7

Version 1

Programming Area: selection ,switch or if-elseEvidence: Full C++ code ,including co&&ents(include )iostrea&* using na&espace std+ int &ain,. //=eclare a varia%le and an array of rando& values int count > 0+ int scoreJ16K > .71'5D'66'EE'FE'ED'5@'77'D5'E5'<<'ED2+ //Use a for loop to #eep running for all 16 values while using an if else state&ent to classify each result4 for, int i >0+ i ) 16+ iLL . if ,scoreJiK *> 70. cout )) scoreJiK )) 0 3s a Birst0 )) endl+ 2 else if ,scoreJiK *> E0 GG scoreJiK)> E@. cout )) scoreJiK )) 0 3s a Upper "econd0 )) endl+ 2 else if ,scoreJiK *> 50 GG scoreJiK)> 5@ . cout )) scoreJiK )) 0 3s a Power "econd0 )) endl+ 2 else if ,scoreJiK *> D0 GG scoreJiK)> D@. cout )) scoreJiK )) 0 3s a 5hird0 )) endl+ 2 else. cout )) scoreJiK )) 0 3s a fail0 )) endl+ 2 2 return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 3 &ade this progra& to classify an array of results into Birst' 61' 66' < grade %oundaries4 5o do this 3 &ade a for loop which counts up to 16 , as there are 16 values- and a couple of 3f 1lse state&ents4 5hese loo# at each value and put it into a certain classification and outputs the result4 5he difficult part here was &a#e sure each result went to the correct %rac#et4

@Coventry University

Page F

Version 1

Programming Area: iteration ,loopsEvidence: Full C++ code ,including co&&ents(include )iostrea&* int &ain,. int nu& > 1+ // ave a while loop to #eep running until they want the progra& to stop while , nu& :>5. //?s# the user to input a value std::cout )) 01nter 1 for "tarter' 6 for Qains' < for =eserts' D for =rin#s or 5 to 1Iit0 )) std::endl+ std::cin ** nu&+ switch ,nu&. //output the relevant teIt when value is entered case 1 : std::cout )) 0"tarters are "oup or Oread Rn Rn0+ %rea#+ case 6 : std::cout )) 0Qains are "unday !oast or Cie Rn Rn0+ %rea#+ case < : std::cout )) 0=eserts are 3ce Crea& or 1ton Qess Rn Rn0+ %rea#+ case D : std::cout )) 0=rin#s are "oft =rin#s' ?lcohol or Coffee Rn Rn0+ %rea#+ case 5 : std::cout )) 0Cress 1nter to 1Iit Rn0+ %rea#+ default : std::cout )) 03nvalid Value4 1nter a Value %etween 1 G 5 Rn Rn0+ %rea#+ 2 2 return 0+ 2 Testing of code ,3ncluding a screenshot of the running progra&-

Reflection: 5his progra& uses a while state&ent to #eep the progra& running and a switch state&ent to display the correct teIt4 Ariginally 3 wanted to allow the user to enter options such as ;Qain; and ;"tarter; however 3 could not get this to wor# so 3 settled on entering integers4 3 %elieve it is %ecause in the switch state&ent i used 00 around the value instead of ;;4

@Coventry University

Page @