Lecture 1 Problem Solving PDF
Document Details
Uploaded by Deleted User
Abdulla Mahdy, Ahmed Morsy, Omar Said
Tags
Summary
This lecture provides a basic introduction to problem-solving and programming, specifically focusing on C++. The content covers programming concepts, tools, and methodologies. It may serve as a course outline for introductory programming courses.
Full Transcript
Problem Solving Traning First Lecture Prepared by: Abdulla Mahdy & Ahmed Morsy & Omar Said Table of contents 01 02 About CPC Introduction to Programming Introduce our self and What Show the first approaches we are doing. of programmi...
Problem Solving Traning First Lecture Prepared by: Abdulla Mahdy & Ahmed Morsy & Omar Said Table of contents 01 02 About CPC Introduction to Programming Introduce our self and What Show the first approaches we are doing. of programming. 03 04 First Program Escape characters & Comment Make your first program, Define escape characters and show then write your own code. how to use and using Comment 01 About CPC Introduce our self and What we are doing. What is CPC? Collage programming competitions are events where participants solve programming problems in a competitive environment. LEVELS OF CPC 01 02 03 04 Local (CPC) Regional (ECPC) National (ACPC) International (ICPC) Often organized by These competitions Competitions held High-profile events individual colleges or typically bring at the national level, that attract universities, these together teams from often featuring the participants from all competitions may various colleges in a top teams from over the world. feature teams from the specific geographical regional same institution or area. competitions. neighboring colleges. Contest Rules Teams typically consist of 3 members. Team members must usually belong to the same university. Problems are usually released at a specific time(commonly 5 hours). Contest Scoreboard Scoreboard is a crucial component that displays the current standing of all participating teams. It allows competitors to track their performance and the performance of other teams in real-time. Contest Rank Correct Submissions: The number of problems solved correctly by the team Incorrect Submissions: The number of incorrect attempts made by the team for each problem Time Penalty: Cumulative time taken by the team to solve the problems, which may include penalties for incorrect submissions. Training Levels Level 1 Level 2 Level 3 Standard Template Libraries Basic syntax, data types, Graph Algorithms (STL) variables and operations Dynamic Programming Searching and Sorting Conditional statements (if-else). Algorithms Greedy Algorithms Loops and Iteration Recursion and Backtracking Game Theory and Mathematics Arrays and Strings Hashing and Hash Maps Advanced Backtracking and Functions and Recursion Search Basic Graph Theory 02 Introduction to Programming Show the first approaches of programming. What is programming and Why We Use it ? Programming is the process of creating a set of instructions that a computer can follow to perform specific tasks. And Why we use it? Solve complex problems. Save time Communicate with computer You must know the language of the computer to give him instructions, but the computer only knows binary numbers(0,1). So we need a translator to convert our language to computer language. How to Start Programming? Programmer Write Compiler convert his instruction it to device language Programmer Translator (Compiler) Device Compiler translate Device execute the the result to use Instruction, then give by programmer output to compiler Types of translator (Compiler) High-Level Low-Level Programming Programming Languages Languages Assembly Language: (NASM, MASM). Python: CPython C: GCC (GNU Compiler Collection) or Clang. Java: (javac) Middle-Level Other Programming Programming Compiler Languages Languages Prolog: SWI-Prolog or GNU Prolog C++: GCC, Clang, and HTML: Rendered by web browsers. TypeScript: TypeScript compiler (tsc). MSVC. Definition of IDE IDE stands for Integrated Development Environment. It is a software application that provides comprehensive facilities to programmers for software development. Examples of Popular IDEs: 1. Visual Studio 2. Eclipse 3. PyCharm 4. Code Blocks Integrated Development Environment (IDE) Code Blocks is a free, open-source Integrated Development Environment (IDE) that is primarily used for C, C++, and Fortran programming. Click to download Code Blocks Watch this video to download 03 First Program Make your first program, then write your own code. First Program After Install the IDE Code block, you are ready to write a code and make your first program To make your first program click on run and build button Describe each line of code #include In C++, #include specifically is used to include the input/output stream library in your C++ program. This library provides functionality for input and output operations, such as reading from the standard input (keyboard) and writing to the standard output (console). using namespace std; Namespace: In C++, namespaces are used to organize code into logical groups and avoid naming conflicts. The C++ Standard Library (STL) defines its entities, including input/output operations, in the std namespace. Accessing Entities: Without using namespace std;, you would need to prefix every reference to an entity from the std namespace with std::. For example, std::cout, std::cin, std::endl, etc. Describe each line of code int main() is a fundamental part of a C++ program. It is the entry point of execution for all C++ programs. When a C++ program is executed, the operating system calls the main() function to start the program's execution. return 0; exits the main() function and returns 0 to indicate successful execution to the operating system. cout