<ul><li>AU/MITM/1.6 </li></ul><ul><li>By Mohammed A. Saleh </li></ul>
<ul><li>The FOR loop </li></ul><ul><li>This is a loop structure that will perform repetitive tasks </li></ul><ul><li>The  ...
<ul><li>Executing the loop actions </li></ul><ul><li>Updating value(s) used for the test </li></ul><ul><li>The initializat...
<ul><li>The  for  loop syntax: </li></ul><ul><li>for (initialization; test-expression;  </li></ul><ul><li>update-expressio...
<ul><li>The  test-expression  determines whether the loop body gets executed. This is normally a relational expression, i....
<ul><li>// num_test.cpp -- use numeric test in for loop  </li></ul><ul><li>#include <iostream>  </li></ul><ul><li>int main...
<ul><li>Here is the output from the program: </li></ul><ul><li>Enter the starting countdown value: 4 </li></ul><ul><li>i =...
<ul><li>The for loop is an  entry-condition  loop. This means the test expression is evaluated before each loop cycle. The...
<ul><li>  Figure 1.0: The FOR loop structure </li></ul>
<ul><li>The DO… WHILE loop </li></ul><ul><li>This is different from the other two loops because it is an  exit-condition  ...
<ul><li>This loop always executes at least once because its program flow must pass through the body of the loop before rea...
<ul><li>Figure 2.0: The DO … WHILE loop structure </li></ul>
<ul><li>An  entry-condition  loop is usually a better choice than an  exit-condition  loop because the  entry-condition  l...
<ul><li>// dowhile.cpp -- exit-condition loop  </li></ul><ul><li>#include <iostream> </li></ul><ul><li>int main()  </li></...
<ul><li>A sample run of the program: </li></ul><ul><li>Enter numbers in the range 1-10 to find my  </li></ul><ul><li>favor...
<ul><li>These are essentially equivalent loops. This  for  loop could be written this way: </li></ul><ul><li>for (init-exp...
<ul><li>Similarly this  while  loop: </li></ul><ul><li>while (test-expression)  </li></ul><ul><li>body </li></ul><ul><li>c...
<ul><li>Identify the condition that terminates loop execution. </li></ul><ul><li>Initialize that condition before the firs...
<ul><li>➩ Module 2 </li></ul><ul><li>Fundamentals of C++ - Operators & Expressions – Data I/O – Control Structures – Stora...
<ul><li>C++ Initiation </li></ul><ul><li>C++ is case sensitive; that is, it discriminates between uppercase characters and...
<ul><li>// Example 1.0 </li></ul><ul><li>// myfirst.cpp--displays a message </li></ul><ul><li>#include <iostream>  // a PR...
<ul><li>C++ programs are constructed from building blocks called functions. Typically, you organize a program into major t...
<ul><li>Comments, indicated by the //prefix </li></ul><ul><li>A preprocessor #include directive  </li></ul><ul><li>A funct...
<ul><li>The main () Function </li></ul><ul><li>Its fundamental structure: </li></ul><ul><li>int main() </li></ul><ul><li>{...
<ul><li>Figure 3.0: The main() Function </li></ul><ul><li>A function constitutes of a  function definition,  which has two...
<ul><li>C++ Statements </li></ul><ul><li>A C++ program is a collection of functions, and each function is a collection of ...
<ul><li>// carrots.cpp -- food processing program  </li></ul><ul><li>// uses and displays a variable  </li></ul><ul><li>#i...
<ul><li>// Example 1.1 - carrots.cpp -- food processing program  </li></ul><ul><li>// uses and displays a variable  </li><...
<ul><li>Program output: </li></ul><ul><li>I have 25 carrots.  </li></ul><ul><li>Crunch, crunch. Now I have 24 carrots. </l...
<ul><li>Why Must Variables Be Declared? </li></ul><ul><li>Comparing C, Pascal and C++ declaration. </li></ul>
<ul><li>Assignment statements   </li></ul><ul><li>Assigns a value to a storage location. For example  carrots = 25; </li><...
<ul><li>carrots = carrots - 1;  // modify the variable </li></ul><ul><li>(carrots - 1) is an arithmetic example. The compu...
<ul><li>Dealing with Data </li></ul><ul><li>The essence of object-oriented programming (OOP) is designing and extending yo...
<ul><li>Simple Variables </li></ul><ul><li>Programs typically need to store information, to do that, the program must keep...
<ul><li>These statements tell the program that it is storing an integer and that the name braincount represents the intege...
<ul><li>The first character in a name cannot be a numeric digit. </li></ul><ul><li>Uppercase characters are considered dis...
<ul><li>Names beginning with a single underscore character are reserved for use as global identifiers by the implementatio...
<ul><li>Int terrier;  </li></ul><ul><li>int my_stars3;  </li></ul><ul><li>int _Mystars3;  </li></ul><ul><li>int 4ever; </l...
<ul><li>Data Types </li></ul><ul><li>Integer types </li></ul><ul><li>Numbers with no fractional part, such as 2, 98, –5286...
<ul><li>Each comes in both signed and unsigned versions. </li></ul><ul><li>By having several choices of integer types,  C+...
<ul><li>You use these type names to declare variables just as you would use  int : </li></ul><ul><li>short  score;   // cr...
<ul><li>You can even initialize a variable to an expression, provided that all the values in the expression are known when...
<ul><li>It’s guaranteed to be large enough to represent the entire range of basic symbols—all the letters, digits, punctua...
<ul><li>Here’s the output from the program:  </li></ul><ul><li>Enter a character:   </li></ul><ul><li>M  </li></ul><ul><li...
<ul><li>The literals true and false can be converted to type int by promotion, with true converting to 1 and false to 0 : ...
<ul><li>C++ has two ways of writing floating-point numbers . </li></ul><ul><li>Standard decimal- point notation </li></ul>...
<ul><li>E notation is most useful for very large and very small numbers. </li></ul><ul><li>The const Qualifier   </li></ul...
<ul><li>const int MONTHS = 12;  // Months is symbolic constant for 12 </li></ul><ul><li>Now you can use MONTHS in a progra...
<ul><li>1. Why does C++ have more than one integer type?  </li></ul><ul><li>2. Declare variables matching the following de...
<ul><li>What is the distinction between 33L and 33? </li></ul><ul><li>Consider the two C++ statements that follow:  </li><...
Upcoming SlideShare
Loading in …5
×

Lecture 2

1,184 views

Published on

Programming Constructs in C++

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,184
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
78
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Lecture 2

  1. 1. <ul><li>AU/MITM/1.6 </li></ul><ul><li>By Mohammed A. Saleh </li></ul>
  2. 2. <ul><li>The FOR loop </li></ul><ul><li>This is a loop structure that will perform repetitive tasks </li></ul><ul><li>The for loop has several parts that handle the repeated actions: </li></ul><ul><li>Setting a value initially </li></ul><ul><li>Performing a test to see whether the loop should continue </li></ul>
  3. 3. <ul><li>Executing the loop actions </li></ul><ul><li>Updating value(s) used for the test </li></ul><ul><li>The initialization (a), test (b), and update actions(d) constitute a three-part control section enclosed in parentheses. </li></ul><ul><li>Each part is an expression, and semicolons separate the expressions from each other. </li></ul><ul><li>The statement following the control section is called the body of the loop, and it is executed as long as the test expression remains true. </li></ul>
  4. 4. <ul><li>The for loop syntax: </li></ul><ul><li>for (initialization; test-expression; </li></ul><ul><li>update-expression) </li></ul><ul><li>body </li></ul><ul><li>Initialization is done just once. This is used as an expression to set a variable to a starting value and then use the variable to count the loop cycles. </li></ul>
  5. 5. <ul><li>The test-expression determines whether the loop body gets executed. This is normally a relational expression, i.e, one that compares two values, e.g (i>5) </li></ul><ul><li>Example of a program used for a numeric test: </li></ul>
  6. 6. <ul><li>// num_test.cpp -- use numeric test in for loop </li></ul><ul><li>#include <iostream> </li></ul><ul><li>int main() </li></ul><ul><li>{ </li></ul><ul><li>int limit; </li></ul><ul><li>cout << “Enter the starting countdown value: “; </li></ul><ul><li>cin >> limit; </li></ul><ul><li>int i; </li></ul><ul><li>for (i = limit; i; i--) // quits when i is 0 </li></ul><ul><li>cout << “i = “ << i << “ ”; </li></ul><ul><li>cout << “Done now that i = “ << i << “ ”; </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
  7. 7. <ul><li>Here is the output from the program: </li></ul><ul><li>Enter the starting countdown value: 4 </li></ul><ul><li>i = 4 </li></ul><ul><li>i = 3 </li></ul><ul><li>i = 2 </li></ul><ul><li>i = 1 </li></ul><ul><li>Done now that i = 0 </li></ul><ul><li>The loop terminates when i reaches 0. </li></ul>
  8. 8. <ul><li>The for loop is an entry-condition loop. This means the test expression is evaluated before each loop cycle. The loop never executes the loop body when the test expression is false. </li></ul><ul><li>The update-expression is evaluated at the end of the loop, after the body has been executed. Typically, it’s used to increase or decrease the value of the variable keeping track of the number of loop cycles. </li></ul>
  9. 9. <ul><li> Figure 1.0: The FOR loop structure </li></ul>
  10. 10. <ul><li>The DO… WHILE loop </li></ul><ul><li>This is different from the other two loops because it is an exit-condition loop. </li></ul><ul><li>It first of all executes the body of the loop and only then evaluates the test expression to see whether it should continue looping. </li></ul><ul><li>If the condition evaluates to false, the loop terminates; otherwise, a new cycle of execution and testing begins </li></ul>
  11. 11. <ul><li>This loop always executes at least once because its program flow must pass through the body of the loop before reaching the test. </li></ul><ul><li>The syntax for the do … while loop: </li></ul><ul><li>do </li></ul><ul><li>body </li></ul><ul><li>while ( test-expression ); </li></ul><ul><li>The body portion can be a single statement or a brace-delimited statement block. </li></ul>
  12. 12. <ul><li>Figure 2.0: The DO … WHILE loop structure </li></ul>
  13. 13. <ul><li>An entry-condition loop is usually a better choice than an exit-condition loop because the entry-condition loop checks before looping. </li></ul><ul><li>A do … while example: </li></ul>
  14. 14. <ul><li>// dowhile.cpp -- exit-condition loop </li></ul><ul><li>#include <iostream> </li></ul><ul><li>int main() </li></ul><ul><li>{ </li></ul><ul><li>int n //variable declaration </li></ul><ul><li>cout << “Enter numbers in the range 1-10 to find “; </li></ul><ul><li>cout << “my favorite number ”; </li></ul><ul><li>do </li></ul><ul><li>{ </li></ul><ul><li>cin >> n; // execute body </li></ul><ul><li>} </li></ul><ul><li>while (n != 7); // then test </li></ul><ul><li>cout << “Yes, 7 is my favorite. ” ; </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
  15. 15. <ul><li>A sample run of the program: </li></ul><ul><li>Enter numbers in the range 1-10 to find my </li></ul><ul><li>favorite number </li></ul><ul><li>9 </li></ul><ul><li>4 </li></ul><ul><li>7 </li></ul><ul><li>Yes, 7 is my favorite. </li></ul>
  16. 16. <ul><li>These are essentially equivalent loops. This for loop could be written this way: </li></ul><ul><li>for (init-expression; test-expression; update-expression) </li></ul><ul><li>{ </li></ul><ul><li>statement(s) </li></ul><ul><li>} </li></ul><ul><li>could be rewritten this way: </li></ul><ul><li>init-expression; </li></ul><ul><li>while (test-expression) </li></ul><ul><li>{ </li></ul><ul><li>statement(s) </li></ul><ul><li>update-expression; } </li></ul>
  17. 17. <ul><li>Similarly this while loop: </li></ul><ul><li>while (test-expression) </li></ul><ul><li>body </li></ul><ul><li>could be rewritten this way: </li></ul><ul><li>for ( ;test-expression;) </li></ul><ul><li>body </li></ul>
  18. 18. <ul><li>Identify the condition that terminates loop execution. </li></ul><ul><li>Initialize that condition before the first test. </li></ul><ul><li>Update the condition in each loop cycle, before the condition is tested again. </li></ul>
  19. 19. <ul><li>➩ Module 2 </li></ul><ul><li>Fundamentals of C++ - Operators & Expressions – Data I/O – Control Structures – Storage Classes – Arrays and Strings. </li></ul>
  20. 20. <ul><li>C++ Initiation </li></ul><ul><li>C++ is case sensitive; that is, it discriminates between uppercase characters and lowercase characters, e.g it uses cout and NOT Cout or COUT. </li></ul><ul><li>The compiler is also spelling sensitive, i.e using kout instead of cout. </li></ul><ul><li>The cpp filename extension is a common way to indicate a C++ program. </li></ul>
  21. 21. <ul><li>// Example 1.0 </li></ul><ul><li>// myfirst.cpp--displays a message </li></ul><ul><li>#include <iostream> // a PREPROCESSOR directive </li></ul><ul><li>int main() // function header </li></ul><ul><li>{ // start of function body </li></ul><ul><li>cout << “Come up and C++ me some time.”; // message </li></ul><ul><li>cout << endl; // start a new line </li></ul><ul><li>cout << “You won’t regret it!” << endl; // more output </li></ul><ul><li>return 0; // terminate main() </li></ul><ul><li>} // end of function body </li></ul>
  22. 22. <ul><li>C++ programs are constructed from building blocks called functions. Typically, you organize a program into major tasks and then design separate functions to handle those tasks. </li></ul><ul><li>Example 1.0 contains a single function named main(). The myfirst.cpp program has the following elements: </li></ul>
  23. 23. <ul><li>Comments, indicated by the //prefix </li></ul><ul><li>A preprocessor #include directive </li></ul><ul><li>A function header: int main() </li></ul><ul><li>A function body, delimited by {and } </li></ul><ul><li>Statements that uses the C++ cout facility to display a message </li></ul><ul><li>A return statement to terminate the </li></ul><ul><li>main() function </li></ul>
  24. 24. <ul><li>The main () Function </li></ul><ul><li>Its fundamental structure: </li></ul><ul><li>int main() </li></ul><ul><li>{ </li></ul><ul><li>statements </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
  25. 25. <ul><li>Figure 3.0: The main() Function </li></ul><ul><li>A function constitutes of a function definition, which has two parts i) function header and ii) function body </li></ul>
  26. 26. <ul><li>C++ Statements </li></ul><ul><li>A C++ program is a collection of functions, and each function is a collection of statements. </li></ul><ul><li>Kinds of statements: </li></ul><ul><li>Declaration statement – creates a variable </li></ul><ul><li>Assignment statement – provides a value for the variable </li></ul>
  27. 27. <ul><li>// carrots.cpp -- food processing program </li></ul><ul><li>// uses and displays a variable </li></ul><ul><li>#include <iostream> </li></ul><ul><li>int main() </li></ul><ul><li>{ </li></ul><ul><li>int carrots; // declare an integer variable </li></ul><ul><li>carrots = 25; // assign a value to the variable </li></ul><ul><li>cout << “I have “; </li></ul><ul><li>cout << carrots; // display the value of the variable </li></ul><ul><li>cout << “ carrots.”; </li></ul><ul><li>cout << endl; </li></ul><ul><li>carrots = carrots - 1; // modify the variable </li></ul><ul><li>cout << “Crunch, crunch. Now I have “ << carrots << “ carrots.” << endl; </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
  28. 28. <ul><li>// Example 1.1 - carrots.cpp -- food processing program </li></ul><ul><li>// uses and displays a variable </li></ul><ul><li>#include <iostream> </li></ul><ul><li>int main() </li></ul><ul><li>{ </li></ul><ul><li>int carrots; // declare an integer variable </li></ul><ul><li>carrots = 25; // assign a value to the variable </li></ul><ul><li>cout << “I have “; </li></ul><ul><li>cout << carrots; // display the value of the variable </li></ul><ul><li>cout << “ carrots.”; </li></ul><ul><li>cout << endl; </li></ul><ul><li>carrots = carrots - 1; // modify the variable </li></ul><ul><li>cout << “Crunch, crunch. Now I have “ << carrots << “ carrots.” << endl; </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
  29. 29. <ul><li>Program output: </li></ul><ul><li>I have 25 carrots. </li></ul><ul><li>Crunch, crunch. Now I have 24 carrots. </li></ul><ul><li>Declaration statements </li></ul><ul><li>To store an item of information in a computer, you must identify both the storage location and how much memory storage space the information requires. </li></ul>
  30. 30. <ul><li>Why Must Variables Be Declared? </li></ul><ul><li>Comparing C, Pascal and C++ declaration. </li></ul>
  31. 31. <ul><li>Assignment statements </li></ul><ul><li>Assigns a value to a storage location. For example carrots = 25; </li></ul><ul><li>Assigns the integer 25 to the location represented by the variable carrots. </li></ul><ul><li>The = symbol is called the assignment operator </li></ul><ul><li>The second assignment statement in Example 1.1 demonstrates that you can change the value of a variable: </li></ul>
  32. 32. <ul><li>carrots = carrots - 1; // modify the variable </li></ul><ul><li>(carrots - 1) is an arithmetic example. The computer will subtract 1 from 25. </li></ul>
  33. 33. <ul><li>Dealing with Data </li></ul><ul><li>The essence of object-oriented programming (OOP) is designing and extending your own data types. But before you can create your own types, you must know and understand the types that are built in to C++ because those types will be your building blocks. </li></ul><ul><li>The built-in C++ types come in two groups: fundamental types and compound types. </li></ul>
  34. 34. <ul><li>Simple Variables </li></ul><ul><li>Programs typically need to store information, to do that, the program must keep track of three fundamental properties: </li></ul><ul><li>Where the information is stored </li></ul><ul><li>What value is kept there </li></ul><ul><li>What kind of information is stored </li></ul><ul><li>Example: </li></ul><ul><li>int braincount; </li></ul><ul><li>braincount = 5; </li></ul>
  35. 35. <ul><li>These statements tell the program that it is storing an integer and that the name braincount represents the integer’s value, 5. </li></ul><ul><li>Names for Variables </li></ul><ul><li>Use meaningful names. </li></ul><ul><li>Naming rules: </li></ul><ul><li>The only characters you can use in names are alphabetic characters, numeric digits, and the underscore (_) character. </li></ul>
  36. 36. <ul><li>The first character in a name cannot be a numeric digit. </li></ul><ul><li>Uppercase characters are considered distinct from lowercase characters. </li></ul><ul><li>You can’t use a C++ keyword for a name . </li></ul><ul><li>Names beginning with two underscore characters or with an underscore character followed by an uppercase letter are reserved for use by the implementation—that is, the compiler and the resources it uses. </li></ul>
  37. 37. <ul><li>Names beginning with a single underscore character are reserved for use as global identifiers by the implementation. </li></ul><ul><li>C++ places no limits on the length of a name, and all characters in a name are significant. </li></ul><ul><li>Some valid and invalid C++ names: </li></ul><ul><li>int poodle; </li></ul><ul><li>int Poodle; </li></ul><ul><li>int POODLE; </li></ul>
  38. 38. <ul><li>Int terrier; </li></ul><ul><li>int my_stars3; </li></ul><ul><li>int _Mystars3; </li></ul><ul><li>int 4ever; </li></ul><ul><li>int double; </li></ul><ul><li>int begin; </li></ul><ul><li>int __fools; </li></ul><ul><li>int honky-tonk; </li></ul><ul><li>int the_very_best_variable_i_can_be_112; </li></ul>
  39. 39. <ul><li>Data Types </li></ul><ul><li>Integer types </li></ul><ul><li>Numbers with no fractional part, such as 2, 98, –5286, and 0. </li></ul><ul><li>C++ provides several choices of integer types to meet a program’s particular requirement. </li></ul><ul><li>These integer types differ in the amount of memory they use to hold an integer. </li></ul><ul><li>Basic integer types, in order of increasing width, are short , int , and long . </li></ul>
  40. 40. <ul><li>Each comes in both signed and unsigned versions. </li></ul><ul><li>By having several choices of integer types, C++ offers a flexible standard with some guaranteed minimum sizes. </li></ul><ul><li>A short integer is at least 16 bits wide. </li></ul><ul><li>An int integer is at least as big as short. </li></ul><ul><li>A long integer is at least 32 bits wide and at least as big as int . </li></ul>
  41. 41. <ul><li>You use these type names to declare variables just as you would use int : </li></ul><ul><li>short score; // creates a type short integer variable </li></ul><ul><li>int temperature; // creates a type int integer variable </li></ul><ul><li>long position; // creates a type long integer variable </li></ul><ul><li>Initialization </li></ul><ul><li>Combines assignment with declaration. For example: </li></ul><ul><li>int uncles = 5; // initialize uncles to 5 </li></ul><ul><li>int aunts = uncles; // initialize aunts to 5 </li></ul>
  42. 42. <ul><li>You can even initialize a variable to an expression, provided that all the values in the expression are known when program execution reaches the declaration: </li></ul><ul><li>int chairs = aunts + uncles + 4; // initialize chairs to 14 </li></ul><ul><li>The char Type </li></ul><ul><li>Designed to store characters, such as letters and numeric digits. </li></ul>
  43. 43. <ul><li>It’s guaranteed to be large enough to represent the entire range of basic symbols—all the letters, digits, punctuation, and the like. </li></ul><ul><li>Example program: </li></ul><ul><li>// chartype.cpp -- the char type </li></ul><ul><li>#include <iostream> </li></ul><ul><li>int main( ) { </li></ul><ul><li>char ch; // declare a char variable </li></ul><ul><li>cout << “Enter a character: “ << endl; </li></ul><ul><li>cin >> ch; </li></ul><ul><li>cout << “Holla! “; </li></ul><ul><li>cout << “Thank you for the “ << ch << “ character.” << endl; </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
  44. 44. <ul><li>Here’s the output from the program: </li></ul><ul><li>Enter a character: </li></ul><ul><li>M </li></ul><ul><li>Holla! Thank you for the M character. </li></ul><ul><li>The bool type </li></ul><ul><li>Represents a Boolean variable one whose value can be either true or false . </li></ul><ul><li>bool isready = true; </li></ul>
  45. 45. <ul><li>The literals true and false can be converted to type int by promotion, with true converting to 1 and false to 0 : </li></ul><ul><li>int ans = true; // ans assigned 1 </li></ul><ul><li>int promise = false; // promise assigned </li></ul><ul><li>Floating-point Types </li></ul><ul><li>C++ has three floating-point types: float, double, and long double </li></ul><ul><li>They are described in terms of the number of significant figures they can represent and the minimum allowable range of exponents </li></ul>
  46. 46. <ul><li>C++ has two ways of writing floating-point numbers . </li></ul><ul><li>Standard decimal- point notation </li></ul><ul><li>12.34 // floating-point </li></ul><ul><li>939001.32 // floating-point </li></ul><ul><li>8.0 // still floating-point </li></ul><ul><li>E notation </li></ul><ul><li>3.45E6 - means that the value 3.45 is multiplied by 1,000,000. T he E6 means 10 to the 6th power. </li></ul>
  47. 47. <ul><li>E notation is most useful for very large and very small numbers. </li></ul><ul><li>The const Qualifier </li></ul><ul><li>C++ provides better way to handle symbolic constants. </li></ul><ul><li>The const keyword to modify a variable declaration and initialization. </li></ul><ul><li>Suppose, for example, that you want a symbolic constant for the number of months in a year: </li></ul>
  48. 48. <ul><li>const int MONTHS = 12; // Months is symbolic constant for 12 </li></ul><ul><li>Now you can use MONTHS in a program instead of 12. </li></ul><ul><li>The keyword const is termed a qualifier because it qualifies the meaning of a declaration. </li></ul><ul><li>General form: </li></ul><ul><li>const type name= value; </li></ul>
  49. 49. <ul><li>1. Why does C++ have more than one integer type? </li></ul><ul><li>2. Declare variables matching the following descriptions: </li></ul><ul><li>A short integer with the value 80 </li></ul><ul><li>An unsigned int integer with the value 42,110 </li></ul><ul><li>An integer with the value 3,000,000,000 </li></ul><ul><li>3. What safeguards does C++ provide to keep you from exceeding the limits of an integer type? </li></ul>
  50. 50. <ul><li>What is the distinction between 33L and 33? </li></ul><ul><li>Consider the two C++ statements that follow: </li></ul><ul><li>char grade = 65; </li></ul><ul><li> char grade = ‘A’; </li></ul><ul><li>Are they equivalent? </li></ul>

×