Module 1 CSC 201
Module 1 CSC 201
Programming in C++
+
AUTHOR---Adekola, Olubukola Daniel
SCHOOL—Computing and
Engineering Sciences
DEPARTMENT—Computer Science
COURSE DESCRIPTION:
An introduction to programming
methodology using C++, problem solving,
algorithm development, basic data types,
control structures, pointers, arrays, functions,
searching and sorting. Major differences
between Procedural and Object oriented
programming. Program style, program
design, code documentation Techniques, and
program correctness. Other topics include file
processing, introduction to stacks and queues
Course Objectives:
By the end of this course, student will be able
to:
differentiate between C and C++ language
design
identify the efficiency of code reusability
inherent in C++
design and develop functional, seamless and
Course Requirements:
Practical Assignment, Experiment and Quizzes
Recommended Texts:
1) Dietel P. and Deitel H.( 2012), C++ How To
Output:
Hello, welcome aboard!
Basic features in the program
1. /* program to compare integer values input from the keyboard; it uses if statement and
2. relational operator. */
3. #include <iostream>
4. using std::cout; Lines 4 – 6: are using directives that removes the
5. using std::cin;
6. using std::endl; need to repeat the std:: in each of the statement like
7. cout. Alternatively, line 4 – 6 can be written as a single
8. int main() line statement as follow:
9. { Using namespace std
10. int num1; //variable name declaration
11. Int num2; //note lines 10 and 11 can also be written as one line: int num1, num2; */
12.
13. cout << “Enter the two integers to compare”; // help the user know what to do next
14. cin >> num1; // receive input from keyboard and store in memory location num1
15. cin >> num2; //num2 is also a temporary memory store as num1
16.
17. If (num1 > num2) // if statement is a conditional test statement
18. cout << num1 << “is greater than “ << num2 <<endl;
19 }
Operators, precedence and
associativity