Programmation
670 documents à télécharger gratuitement
Cours, examens, TD, TP et exercices de programmation. Thèmes couverts : algorithmique, langage C, Java, Python, POO, structures de données.
This document provides an in-depth tutorial on linked lists in C programming, contrasting them with arrays in terms of memory and flexibility. It includes essential topics such as declaring linked lists, adding and removing elements (head and tail), searching for an element, and counting occurrences or total elements in the list. Additionally, practical examples of recursive and iterative implementations are presented with C code snippets to help developers effectively manipulate linked lists.
This document serves as a comprehensive instructional guide for assembly language programming with a focus on data declarations, stack usage, and procedures. It provides structured explanations of segment declarations (data, stack, and code), variable initialization rules, and pseudo-instruction usage. Detailed examples for defining variables, using the stack, and writing procedures are included. Practical exercises are provided for implementing message display, keyboard input storage, and manipulation of tables in memory, enabling hands-on learning and debugging validation.
This document comprehensively outlines the foundational structure of assembly language programs by dividing them into key segments: data, stack, and code. It explains essential declarations, variable initialization, and the use of pseudo-instructions, such as DB, DW, and DD, to define memory usage. Detailed instructions for stack and procedure usage are provided, along with examples demonstrating input/output operations via DOS interrupt functions. Exercises cover memory storage, displaying characters, keyboard input handling, and various table manipulations via assembly code.
The document is a comprehensive guide to assembly language programming, including segment declaration for data, stack, and code, as well as the use and manipulation of variables, arrays, and procedures. It outlines initialization techniques for data and stack segments, introduces pseudo-instructions such as DB, DW, and DD, and explains the organization of code with examples of procedures and interrupt service routines. Moreover, it provides practical exercises for memory management, displaying messages, interacting with the keyboard, and manipulating and processing arrays, along with explan...
This document explains the concept of structures in the C programming language, contrasting them with arrays and describing their syntax and usage. It provides methods to define, initialize, and utilize structures, including best practices and examples. Applications explore creating and managing data for planets, with functions to handle structured data efficiently. Finally, it delves into advanced topics like structure pointers, linked lists, and dynamic memory allocation.
This document comprehensively introduces the concept of structures ('struct') in the C programming language, highlighting their syntax, declaration methods, and usage in storing heterogeneous data types. Special attention is given to struct-related operations like member access, initialization, assignment, and comparison. Applications include defining structures for representing entities like planets, guiding users through the application of functions to create, display, and compare structured data. Advanced topics such as pointers to structures and dynamic memory allocation using `malloc`...
This document introduces and explains data structures in the C programming language, focusing on struct types. The tutorial covers the definition, initialization, and manipulation of structures, including methods for declaring variables, passing structures as function parameters, and utilizing arrays of structures. Advanced concepts like pointers to structures, dynamic memory allocation using malloc and calloc, and linked structures are also explained in detail. Applications include creating and comparing planetary data models using structured data types.
This document introduces the concept of recursion in programming, contrasting it with iterative approaches. It explains direct and mutual recursion with detailed examples, including factorial computation through iterative and recursive methods. Principles for writing recursive functions, such as incorporating base cases, are emphasized to avoid infinite recursion. Additionally, the document provides multiple exercises for practicing recursive and iterative techniques in C programming, highlighting their applications.
This document explores the concept of recursion in programming, describing how recursive functions can replace iterative loops to solve problems more elegantly. It provides examples of recursive and iterative implementations for factorial calculations, discussing the essential components of recursion such as base cases and general cases, as well as potential pitfalls when developing recursive algorithms. The document concludes with practical exercises for implementing recursion, such as calculating sums, powers, and applying recursion to specific algorithmic problems like quicksort.
This document introduces the concept of recursion in programming, explaining its mechanics and differences compared to iterative programming techniques. It demonstrates the recursive and iterative implementations of classic problems, such as calculating factorials, summing integers, and computing powers. Key aspects of recursive functions, including base cases and general cases, are outlined to prevent potential inefficiencies or infinite recursion. Additional examples highlight both correct and flawed recursive approaches, emphasizing common pitfalls and best practices.
This document is an exam-like exercise series designed to test foundational knowledge in pointers for first-year computer science students. The exercises involve filling tables based on pointer arithmetic operations and memory address manipulations, writing C programs to perform array manipulations using pointers, and solving pointer-related problems. The methodology focuses on practical application of pointer concepts with step-by-step implementations. Students are challenged to predict outcomes in pointer behavior and program execution within the C programming language.
This document provides a series of practical exercises on programming with pointers, targeted towards first-year computer science students. The exercises encompass analyzing and modifying pointer operations within C programs, calculating pointer arithmetic, and creating programs to manipulate arrays using pointers. Key methodologies include tracing pointer behavior step-by-step, implementing array operations, and debugging. Essential findings include insights into the behavior of memory addressing, pointer arithmetic, and various pointer-based algorithms for array manipulation.
This document presents a series of C programming exercises tailored to first-year Computer Science students. The exercises focus on implementing repetitive structures, manipulating strings, and solving mathematical and text-processing problems. Key tasks include reimplementing loop-based programs with alternative structures, solving quadratic equations programmatically, and processing and transforming character-based input. The exercises encourage logical reasoning while developing proficiency in C, covering fundamental programming concepts and use cases.
This document presents a series of programming exercises designed for first-year computer science students to practice and learn structured programming in C. The exercises involve tasks such as converting 'for' loops to 'while' loops, solving second-degree equations, building arithmetic tables, converting character cases, binary transformations, text manipulation, and data compression using encoding. Each problem challenges students to implement algorithms that enhance their logical reasoning and programming skills.
This document provides a collection of programming exercises for C language learners, targeting specific logical structures such as loops and conditionals. The exercises include implementing mathematical equation solvers, character manipulation, text transformations, and data compression algorithms. A significant portion of these exercises challenges students to translate 'for' loops into 'while' loops and handle user input effectively. The document concludes with practical string and mathematical operations that help reinforce critical programming skills.
This document contains a series of algorithmic exercises aimed at first-year Computer Science students. It includes tasks involving static and dynamic memory structures, such as arrays and records, to handle data about students, employees, and library management. The exercises emphasize coding problems like sorting students by grades, calculating employee salaries within given dates, and tracking library books borrowed. The focus is on practical problem-solving using algorithms, with the implementation of key programming constructs like functions, procedures, and dynamic storage management.
The document outlines programming exercises focused on binary file handling in C as part of an advanced programming workshop. Exercise 1 involves implementing a system to create, read, display, and modify a binary file containing student records. Exercise 2 focuses on managing dynamic records with varying numbers of grades and simultaneously maintaining an index file to track record sizes. Both exercises emphasize the use of structs and dynamic memory allocation, requiring functions for file population, data retrieval, and record manipulation.
The document provides an overview of pointer usage in C programming, particularly focusing on handling single pointers, double pointers, triple pointers, and arrays. It demonstrates the declaration of pointers and the invocation of various functions that use these pointers. The methodology emphasizes the distinction between arrays and pointers when passing parameters. The findings underline the correct ways to pass pointers to functions and avoid common mistakes such as including '&' with arrays.
This document elaborates on the use of pointers in C programming to manipulate variables, arrays, and structured data types such as 'ETUDIANT'. It describes various function prototypes and their usage, emphasizing how pointers interact with individual variables, arrays, and structures. The code highlights best practices for passing addresses and underscores distinctions between direct pointers and pointers to pointers. It provides specific guidance on the handling of arrays by addressing their inherent properties, avoiding unnecessary dereferencing.
This document provides exercises related to loops in the C programming language, focusing on while loops and nested for loops. Eight examples are included, each exploring different behavior in loop execution and variable handling. Key programming concepts such as iteration, nested loops, and scope of variables are demonstrated. The document is aimed at first-year computer science students and emphasizes understanding program output.
This document provides examples of loop structures in C programming designed for first-year university students. It covers eight small programs demonstrating basic loop operations including 'while', 'for', and nested loop constructs. Each example outputs specific behavior for incrementing variables or nested operations and is accompanied by explanations of the results. The material is aimed at building foundational skills in understanding the mechanics and outputs of loops, intended for beginner programmers.
This document covers the operations of handling text files in C programming. It focuses on defining structures, such as student information, and implementing functions to write and read data to and from a file using functions like `fprintf`, `fscanf`, `fputs`, and `fgets`. It also highlights error handling and differences between various file handling methods. The examples include practical exercises for creating, filling, and displaying data from text files.
This document provides a detailed exploration of handling text files in the C programming language, primarily focusing on how to read, write, and manipulate data in files using functions like `fopen`, `fprintf`, `fscanf`, `fputs`, and `fgets`. Multiple examples and exercises are provided to demonstrate filling and displaying student records from a file using structured data representations (`struct`). The guidelines for using file functions correctly, with notes on error handling and memory considerations, are thoroughly covered. Practical coding examples illustrate the implementation for e...
This document provides an advanced programming guide on handling text files in C. It covers techniques for input and output operations using functions like fprintf, fscanf, fputs, and fgets, illustrating their usage with examples. Detailed code snippets demonstrate how to create, fill, and display student records in both text and binary formats. Additionally, the document discusses edge cases, such as handling errors and end-of-file conditions, and contrasts different functions with examples.


















