assigment - ahmad ikhtiaruddin bin abdullah.docx

Upload: aana-solehah

Post on 12-Feb-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/23/2019 Assigment - Ahmad Ikhtiaruddin Bin Abdullah.docx

    1/4

    WHO IS WRITTEN C++

    Bjarne Stroustrup born 30 December 1950) is a Danish computer scientist,most notable for

    the creation and development of the widely used C++prorammin lanuae!"#$%e is a

    Distinuished &esearch 'rofessor and holds the Collee of (nineerin Chair in Computer

    cience at *eas -. /niversity, a visitin professor atColumbia /niversity, and wors

    at .oran tanley.

    EDUCATION

    troustrup has a masters dereein mathematicsand computer science 2195) fromarhus/niversity, Denmar, and a'h!D!in computer science 2199) from the /niversity of Cambride,(nland ! %is thesis advisor in Cambride wasDavid 4heeler

    CAREER

    troustrup bean developin C++ in 19 2then called 6Cwith Classes6), and, in his own words,6invented C++, wrote its early definitions, and produced its first implementation!!! chose andformulated the desin criteria for C++, desined all its ma7or facilities, and was responsible forthe processin of etension proposals in the C++ standards committee! troustrup also wrote atetboo for the lanuae,The C++ Programming Language!

    2. State statement below and give an eam!le a!!li"ation in C++

    #$og$am .

    a% Go to :The labeled statement designated by identifermust be in the current

    function. All identifernames are members of an internal namespace and therefore

    do not interfere with other identiers.

    A statement label is meaningful only to a go tostatement; otherwise, statement

    labels are ignored. Labels cannot be redeclared.

    It is good programming style to use the b$ea&, "ontin'e, and $et'$nstatements

    instead of he go tostatement whenever possible. However, because

    https://en.wikipedia.org/wiki/Computer_scientisthttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/Bjarne_Stroustrup#cite_note-4https://en.wikipedia.org/wiki/Texas_A%26M_Universityhttps://en.wikipedia.org/wiki/Columbia_Universityhttps://en.wikipedia.org/wiki/Morgan_Stanleyhttps://en.wikipedia.org/wiki/Master's_degreehttps://en.wikipedia.org/wiki/Mathematicshttps://en.wikipedia.org/wiki/Computer_sciencehttps://en.wikipedia.org/wiki/Aarhus_Universityhttps://en.wikipedia.org/wiki/Aarhus_Universityhttps://en.wikipedia.org/wiki/Doctor_of_Philosophyhttps://en.wikipedia.org/wiki/University_of_Cambridgehttps://en.wikipedia.org/wiki/David_Wheeler_(computer_scientist)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/The_C%2B%2B_Programming_Languagehttps://en.wikipedia.org/wiki/The_C%2B%2B_Programming_Languagehttps://en.wikipedia.org/wiki/C%2B%2Bhttps://en.wikipedia.org/wiki/Bjarne_Stroustrup#cite_note-4https://en.wikipedia.org/wiki/Texas_A%26M_Universityhttps://en.wikipedia.org/wiki/Columbia_Universityhttps://en.wikipedia.org/wiki/Morgan_Stanleyhttps://en.wikipedia.org/wiki/Master's_degreehttps://en.wikipedia.org/wiki/Mathematicshttps://en.wikipedia.org/wiki/Computer_sciencehttps://en.wikipedia.org/wiki/Aarhus_Universityhttps://en.wikipedia.org/wiki/Aarhus_Universityhttps://en.wikipedia.org/wiki/Doctor_of_Philosophyhttps://en.wikipedia.org/wiki/University_of_Cambridgehttps://en.wikipedia.org/wiki/David_Wheeler_(computer_scientist)https://en.wikipedia.org/wiki/C_(programming_language)https://en.wikipedia.org/wiki/The_C%2B%2B_Programming_Languagehttps://en.wikipedia.org/wiki/Computer_scientist
  • 7/23/2019 Assigment - Ahmad Ikhtiaruddin Bin Abdullah.docx

    2/4

    the b$ea&statement eits from only one level of a loop, you might have to use a go

    tostatement to eit a deeply nested loop.

    !ample "o To #

    b% W(ile # Here, statement(s)may be a single statement or a block of statements.The conditionmay be any expression, and true is any non-zero value. The loop iterates while

    the condition is true.

    Eam!le W(ile )

    c) Break And Continue: *here are two statements 2brea$;and continue;) built in C++

    prorammin to alter the normal flow of proram! 8oops are used to perform

    repetitive tas until test epression is false but sometimes it is desirable to sipsome statements inside loop or terminate the loop immediately with checin test

  • 7/23/2019 Assigment - Ahmad Ikhtiaruddin Bin Abdullah.docx

    3/4

    condition! :n these type of scenarios, continue;statement and brea$;statement is

    used respectively! *he ;rea statement is also used to terminate switch statement!

    Eam!le *$ea& And Contin'e#

    d% W(ile T$'e# Im curious about using a whilestatement with a true condition. !hat isthe advantage of using a while"true# statement with break to exit the while statement over

    something like a for loop$ I guess Im %ust curious when a good time to use this techni&ue

    would be$ I saw it demonstrated in a &uick sort algorithm at school today and was %ust

    curious about it.

    Eam!le W(ile T$'e )

  • 7/23/2019 Assigment - Ahmad Ikhtiaruddin Bin Abdullah.docx

    4/4

    e) Do / While: 'nlike forand whileloops, which test the loop condition at the top of

    the loop, the do...whileloop checks its condition at the bottom of the loop.

    ( do...whileloop is similar to a while loop, except that a do...while loop is

    guaranteed to execute at least one time.

    Example Do/While :

    % ,'m! - oo!# A %&& 'ump statement performs an immediate local transfer ofcontrol.

    Eam!le ,'m! - oo! )

    g% I - Else ) (n ifstatement can be followed by an optional elsestatement, which

    executes when the boolean expression is false.

    Eam!le I - Else )