Основни задачи с файлове. 1. Създаване на файл с фиксиран брой записи Program p1; Type Fl=file of real; Var F:Fl; T:real; I,N:integer; Begin Write(N=);

Slides:



Advertisements
Similar presentations
Триъгълник на Паскал.
Advertisements

James Tam Linked Lists in Pascal Linked Lists In this section of notes you will learn how to create and manage a dynamic list.
E.g.9 For to do loop for i:=1 to 10 do writeln(i); While do loop i:=1;
Selection Process If … then … else.... Condition Process 2 Process 1 Y.
1 Data Type Anan Phonphoem Data Type Ordinal TypeNon-ordinal Type StandardUser Define Enumerated Subrange Integer Char Boolean Real.
ІІ етап Всеукраїнської олімпіади з інформатики
Selection If Flowchart A diagram that shows step-by-step progression through a procedure or system especially using connecting lines and a set of conventional.
L which include file needs to be used for string manipulation? what using statement needs to be included fro string manipulation? l how is a string assigned.
Introduction to Programming CSCE 110 Drawn from James Tam’s material.
J. Michael Moore Text Files CSCE 110 From James Tam’s material.
James Tam Arrays In this section of notes you will be introduced to a homogeneous composite type, one- dimensional arrays.
James Tam Arrays In this section of notes you will be introduced to a homogeneous composite type, one- dimensional arrays.
James Tam Introduction To Files In Pascal In this section of notes you will learn how to read from and write to files in Pascal.
James Tam Introduction To Files In Pascal In this section of notes you will learn how to read from and write to files in your Pascal programs.
J. Michael Moore From James Tam’s material Multi-Dimensional Arrays CSCE 110.
Homework Read pages 304 – 309 Page 310: 1, 6, 8, 9, 15, 28-31, 65, 66, 67, 69, 70, 71, 75, 89, 90, 92, 95, 102, 103, 127.
J. Michael Moore Arrays CSCE 110 From James Tam’s material.
James Tam Arrays In this section of notes you will be introduced to a homogeneous composite type, one- dimensional arrays.
J. Michael Moore From James Tam’s material Multi-Dimensional Arrays CSCE 110.
James Tam Arrays In this section of notes you will be introduced to a homogeneous composite type, one- dimensional arrays.
James Tam Introduction To Files In Pascal You will learn how to read from and write to text files in Pascal.
J. Michael Moore Arrays CSCE 110. J. Michael Moore Typical (although simplified) Problem Write a program that will track student grades in a class. The.
Introduction to Programming
James Tam Introduction To Files In Pascal In this section of notes you will learn how to read from and write to files in Pascal.
James Tam Introduction To Files In Pascal In this section of notes you will learn how to read from and write to text files in Pascal.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 11, Lecture 2 (Wed)
ARRAY PADA PASCAL DOSEN : NURAINI PURWANDARI.
1 The CONST definition CONST Pi = , City = ‘New York’; Constant identifiers are used when you do not want the value of an identifier to change why.
Pascal Programming Strings, Arithmetic operators and output formatting National Certificate – Unit 4 Carl Smith.
Copyright 1999 by Larry Fuhrer. Pascal Programming Getting Started...
Introduction to Pascal The Basics of Program writing.
Pascal Programming Files and Text (an intro). Pascal Programming Files... Data files need to be retained in secondary memory. The machine memory is random.
Arithmetic in Pascal A Short Glance We will learn the followings in this chapter Arithmetic operators Order of precedence Assignment statements Arithmetic.
Pascal Programming Today Chapter 11 1 Chapter 11.
Объекты - списки unit List; interface type TElem = class public p: TElem; s: integer; constructor Create(r: TElem); function Len: integer; function Sum:
1 More on Readln:numerical values Note: ENTER key counts sends a carriage return and a line feed to the computer definition: “white space”: space, tab,
Using Records. Declaration Statement Type StudentEntry = Record Name : String[20]; ID : String[9]; Grade : Integer; End; Var Student :StudentEntry;
Array : 1-dimension อนันต์ ผลเพิ่ม Anan Phonphoem
CMP 131 Introduction to Computer Programming
FUNCTIONS (METHODS) Pascal C, C++ Java Scripting Languages Passing by value, reference Void and non-void return types.
Same Signs Different Signs 1) =+7 Objective- To solve problems involving operations with integers. Combining.
Input and Output Output Prompt: –A message displayed to the user indicating what they are to enter. Should be clear and exact on what you want. write:
FOR LOOP STRUCTURE For := to do eg. for I := 1 to 100 do begin writeln(‘This is a loop’); end;
Быстрое введение в язык C++
RECORDS Introduction Declaring a record Using records
The CONST definition CONST Pi = , City = ‘New York’;
CPSC Pascal Brent M. Dingle Texas A&M University 2001, 2002
ASSIGNMENT NO.-2.
تهیه و تنظیم: فاطمه قاسمی دانشگاه صنعتی شریف – پاییز 86
Потпрограми во Pascal.
CMP 131 Introduction to Computer Programming
Паскаль тілінде бағдарламалау II Бөлім
Көңіл күйлеріңіз қалай?
Сызықтық алгоритмдерді бағдарламалау
CMPE 152: Compiler Design October 2 Class Meeting
Бірөлшемді жиымдар Паскаль тілінде бағдарламалау
Brent M. Dingle Texas A&M University Chapter 12 – section 1
Computer Science II First With files.
kbkjlj/m/lkiubljj'pl;
Vježbanje.
Vježbanje.
Arrays In this section of notes you will be introduced to a homogeneous composite type, one-dimensional arrays One-dimensional arrays in Pascal.
CS 432: Compiler Construction Lecture 11
Паскаль тілінің басқару
Қайталау операторлары
9 сынып 8 сабақ Сабақтың тақырыбы: Дейін циклі REPEAT операторы.
7.1 Roots and Rational Exponents
Assignment #3 Programming Language, Spring 2003
CMPE 152: Compiler Design March 7 Class Meeting
Computer Science II First With files.
Presentation transcript:

Основни задачи с файлове

1. Създаване на файл с фиксиран брой записи Program p1; Type Fl=file of real; Var F:Fl; T:real; I,N:integer; Begin Write(N=); readln(N); assign(F,Temp.dat); Rewrite(F); For I:=1 to N do Begin read(T); write(F,T); end; Close(f); End.

2. Създаване на файл с неопределен брой записи Type Fl=file of real; Var F:Fl; Procedure FlCreate(var:F:Fl); {процедура за въвеждане} Var Nr:real; Begin rewrite(F); write(>); read(Nr); While not eof do {въвеждането спира след натискане на Ctrl+Z} Begin readln; write(F,Nr); write(>); read(Nr); end; Close(F); End; Begin assign(F,Temp.dat); Writeln(Създаване на файл); FlCreate(F); End.

3. Извеждане на файл с неопределен брой записи Type Fl=file of real; Var F:Fl; Procedure FlRead(var:F:Fl); {процедура за извеждане} Var Nr:real; Begin reset(F); While not eof(F) do Begin read(F,Nr); writeln(F,Nr:8:2); end; Close(F); End; Begin assign(F,Temp.dat); Writeln(Отпечатване на файл); FlRead(F); End.