0% found this document useful (0 votes)
2 views2 pages

CS201 Short Notes

The document provides an overview of programming, defining it as the process of writing instructions for computers. It covers programming languages, the basic structure of a C++ program, variables and data types, input/output operations, conditional statements, loops, functions, arrays, and pointers. Each section includes examples and syntax relevant to C++ programming.

Uploaded by

Umair ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

CS201 Short Notes

The document provides an overview of programming, defining it as the process of writing instructions for computers. It covers programming languages, the basic structure of a C++ program, variables and data types, input/output operations, conditional statements, loops, functions, arrays, and pointers. Each section includes examples and syntax relevant to C++ programming.

Uploaded by

Umair ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS201 - Introduction to Programming (Short Notes)

1. What is Programming?

Programming is the process of writing instructions (code) for a computer to perform specific tasks.

2. Programming Languages:

- High-Level Languages: Easy to understand (e.g., C++, Java)

- Low-Level Languages: Closer to machine code (e.g., Assembly)

3. Basic Structure of a C++ Program:

#include <iostream>

using namespace std;

int main() {

// code

return 0;

4. Variables and Data Types:

- Variable: A container to store data

- Common Data Types: int, float, char, bool, string

5. Input/Output in C++:

- Input: cin >> variable;

- Output: cout << "Message";

6. Conditional Statements:

- if, if-else, else-if: Used to make decisions

- Syntax: if (condition) { // code }

7. Loops:

- for, while, do-while: Used for repetition


- for (int i = 0; i < n; i++) { // code }

8. Functions:

A block of code that performs a specific task.

- Syntax: returnType functionName(parameters) { // code }

9. Arrays:

Used to store multiple values of the same type.

- int arr[5] = {1, 2, 3, 4, 5};

10. Pointers (Basic):

A pointer stores the address of a variable.

- int *ptr = &x;

You might also like