This document contains program code and notes about programming concepts like procedures, functions, variables, sets, and arrays. It discusses different types of variables, set operations, reading and printing sets, and provides examples of code for procedures to input and output sets. It also provides exercises asking the reader to write a program to manage student enrollment in math and English classes using sets and arrays.
Java Programming is the most desirable IT training courses in Nepal which is known for reliability, maintainability, and ease of development. Our Java training course comprises a practical method of learning in order to provide a real-time experience. This Java Training course will not only include all the fundamental concepts but also the advanced concepts like Method Overloading & Overriding, Inheritance, Interface, Database connectivity, etc.
Moore's Law may be dead, but CPUs acquire more cores every year. If you want to minimize response latency in your application, you need to use every last core - without wasting resources that would destroy performance and throughput. Traditional locks grind threads to a halt and are prone to deadlocks, and although actors provide a saner alternative, they compose poorly and are at best weakly-typed.
In this presentation, created exclusively for Scalar Conf, John reveals a new alternative to the horrors of traditional concurrency, directly comparing it to other leading approaches in Scala. Witness the beauty, simplicity, and power of declarative concurrency, as you discover how functional programming is the most practical solution to solving the tough challenges of concurrency.
Java Programming is the most desirable IT training courses in Nepal which is known for reliability, maintainability, and ease of development. Our Java training course comprises a practical method of learning in order to provide a real-time experience. This Java Training course will not only include all the fundamental concepts but also the advanced concepts like Method Overloading & Overriding, Inheritance, Interface, Database connectivity, etc.
Moore's Law may be dead, but CPUs acquire more cores every year. If you want to minimize response latency in your application, you need to use every last core - without wasting resources that would destroy performance and throughput. Traditional locks grind threads to a halt and are prone to deadlocks, and although actors provide a saner alternative, they compose poorly and are at best weakly-typed.
In this presentation, created exclusively for Scalar Conf, John reveals a new alternative to the horrors of traditional concurrency, directly comparing it to other leading approaches in Scala. Witness the beauty, simplicity, and power of declarative concurrency, as you discover how functional programming is the most practical solution to solving the tough challenges of concurrency.
Crafting Custom Interfaces with Sub::ExporterRicardo Signes
Everybody knows about Exporter.pm: you use it, and if someone uses your module, they don't have to type quite as much. We'll look at how the Exporter works, and how it fails to take advantage of the powerful concepts on which it's built. We'll see how you can provide flexible import routines that allow your module's user to type even less and get code that behaves much more like part of his own program. You can avoid repeating unnecessary parameters to every overly-generic routine and can avoid collision-prone global configuration. All of this is made possible -- and easy -- by Sub::Exporter.
Generators -- routines that build routines -- can produce customized code, built to each importer's specifications. Sub::Exporter lets you build and provide customized routines easily. You'll learn how to write generators, and how to use them with Sub::Exporter . In its simplest form, it's as easy to use as Exporter.pm. With just a bit more configuration, it can build, group, rename, and julienne routines easily. With this tool, you'll be able to provide interfaces that are both simpler and more powerful than those provided by the stock Exporter.
Final tagless. The topic strikes fear into the hearts of Scala developers everywhere—and not without reason. Final tagless allows developers to build composable Domain Specific Languages (DSLs) that model interaction with the outside world. Programs written using the final tagless style can be tested deterministically and reasoned about at compile-time. Yet the technique requires confusing, compiler-choking higher-kinded types, like `F[_]`, and pervasive, non-inferable context bounds like `F[_]: Concurrent: Console: Logging`. Many have looked at final tagless and wondered if all the layers of complexity and ceremony are really worth the benefits.
In this presentation, John A. De Goes provides a gentle and accessible introduction to final tagless, explaining what it is and the problem it intends to solve. John shows that while final tagless is easier to use than free monads, the technique suffers from a litany of drawbacks that push developers away from functional programming in Scala. John then introduces a novel approach that shares some of the benefits of final tagless, but which is idiomatic Scala, easy to explain, doesn’t need any complex type machinery, provides flawless type inference, and works beautifully across Scala 2.x and Scala 3.
Come join John for an evening of fun as you learn how to write functional code in Scala that's easy to test and easy to reason about—all without the complexity of free monads or final tagless.
Programming Fundamentals Arrays and Strings imtiazalijoono
Programming Fundamentals
Arrays and Strings
• Arrays
• Initializing arrays
• Multidimensional arrays
• Arrays as arguments to functions
• Strings
• String functions
Accessing Individual Components
Declaring Arrays
Arrays: Example Garbage
Multidimensional Arrays
1) Write a C program using arrays that produces the multiplication of two 2x2 matrices.
3-Dimensional Array
Write a program of your own choice that makes use of arrays of more than 2 dimensions.
2-Dimensional Arrays
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...Philip Schwarz
Java’s records, sealed interfaces and text blocks are catching up with Scala’s case classes, sealed traits and multiline strings
Judge for yourself in this quick IDE-based visual comparison
of the Scala and Java translations of Martin Fowler’s refactored Javascript code.
FS2 (previously called Scalaz-Stream) is a library that facilitates purely functional API to encode stream processing in a modular and composable manner.
Due to its functional abstraction around "streams" of data, FS2 enables isolating and delaying the side-effects until the streams are fully composed and assembled into its final execution context.
The main objectives of this talk are to get started with FS2, particularly with its functional approach to stream processing, and to dive into details of its semantics.
1. Perform Linear Search and Binary Search on an array.
Descriptions of the programs:
Read and array of type integer.
Input element from user for searching.
Search the element by passing the array to a function and then returning the position of the element from the function else return -1 if the element is not found.
Display the positions where the element has been found.
2. Implement sparse matrix using array.
Description of program:
Read a 2D array from the user.
Store it in the sparse matrix form, use array of structures.
Print the final array.
3. Create a linked list with nodes having information about a student and perform.
Description of the program:
Insert a new node at specified position.
Delete of a node with the roll number of student specified.
Reversal of that linked list.
4. Create doubly linked list with nodes having information about an employee and perform Insertion at front of doubly linked list and perform deletion at end of that doubly linked list.
5. Create circular linked list having information about a college and perform Insertion at front perform Deletion at end.
6. Create a stack and perform Pop, Push, Traverse operations on the stack using Linear Linked list.
7. Create a Linear Queue using Linked List and implement different operations such as Insert, Delete, and Display the queue elements.
Crafting Custom Interfaces with Sub::ExporterRicardo Signes
Everybody knows about Exporter.pm: you use it, and if someone uses your module, they don't have to type quite as much. We'll look at how the Exporter works, and how it fails to take advantage of the powerful concepts on which it's built. We'll see how you can provide flexible import routines that allow your module's user to type even less and get code that behaves much more like part of his own program. You can avoid repeating unnecessary parameters to every overly-generic routine and can avoid collision-prone global configuration. All of this is made possible -- and easy -- by Sub::Exporter.
Generators -- routines that build routines -- can produce customized code, built to each importer's specifications. Sub::Exporter lets you build and provide customized routines easily. You'll learn how to write generators, and how to use them with Sub::Exporter . In its simplest form, it's as easy to use as Exporter.pm. With just a bit more configuration, it can build, group, rename, and julienne routines easily. With this tool, you'll be able to provide interfaces that are both simpler and more powerful than those provided by the stock Exporter.
Final tagless. The topic strikes fear into the hearts of Scala developers everywhere—and not without reason. Final tagless allows developers to build composable Domain Specific Languages (DSLs) that model interaction with the outside world. Programs written using the final tagless style can be tested deterministically and reasoned about at compile-time. Yet the technique requires confusing, compiler-choking higher-kinded types, like `F[_]`, and pervasive, non-inferable context bounds like `F[_]: Concurrent: Console: Logging`. Many have looked at final tagless and wondered if all the layers of complexity and ceremony are really worth the benefits.
In this presentation, John A. De Goes provides a gentle and accessible introduction to final tagless, explaining what it is and the problem it intends to solve. John shows that while final tagless is easier to use than free monads, the technique suffers from a litany of drawbacks that push developers away from functional programming in Scala. John then introduces a novel approach that shares some of the benefits of final tagless, but which is idiomatic Scala, easy to explain, doesn’t need any complex type machinery, provides flawless type inference, and works beautifully across Scala 2.x and Scala 3.
Come join John for an evening of fun as you learn how to write functional code in Scala that's easy to test and easy to reason about—all without the complexity of free monads or final tagless.
Programming Fundamentals Arrays and Strings imtiazalijoono
Programming Fundamentals
Arrays and Strings
• Arrays
• Initializing arrays
• Multidimensional arrays
• Arrays as arguments to functions
• Strings
• String functions
Accessing Individual Components
Declaring Arrays
Arrays: Example Garbage
Multidimensional Arrays
1) Write a C program using arrays that produces the multiplication of two 2x2 matrices.
3-Dimensional Array
Write a program of your own choice that makes use of arrays of more than 2 dimensions.
2-Dimensional Arrays
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...Philip Schwarz
Java’s records, sealed interfaces and text blocks are catching up with Scala’s case classes, sealed traits and multiline strings
Judge for yourself in this quick IDE-based visual comparison
of the Scala and Java translations of Martin Fowler’s refactored Javascript code.
FS2 (previously called Scalaz-Stream) is a library that facilitates purely functional API to encode stream processing in a modular and composable manner.
Due to its functional abstraction around "streams" of data, FS2 enables isolating and delaying the side-effects until the streams are fully composed and assembled into its final execution context.
The main objectives of this talk are to get started with FS2, particularly with its functional approach to stream processing, and to dive into details of its semantics.
1. Perform Linear Search and Binary Search on an array.
Descriptions of the programs:
Read and array of type integer.
Input element from user for searching.
Search the element by passing the array to a function and then returning the position of the element from the function else return -1 if the element is not found.
Display the positions where the element has been found.
2. Implement sparse matrix using array.
Description of program:
Read a 2D array from the user.
Store it in the sparse matrix form, use array of structures.
Print the final array.
3. Create a linked list with nodes having information about a student and perform.
Description of the program:
Insert a new node at specified position.
Delete of a node with the roll number of student specified.
Reversal of that linked list.
4. Create doubly linked list with nodes having information about an employee and perform Insertion at front of doubly linked list and perform deletion at end of that doubly linked list.
5. Create circular linked list having information about a college and perform Insertion at front perform Deletion at end.
6. Create a stack and perform Pop, Push, Traverse operations on the stack using Linear Linked list.
7. Create a Linear Queue using Linked List and implement different operations such as Insert, Delete, and Display the queue elements.
Let us C (by yashvant Kanetkar) chapter 3 SolutionHazrat Bilal
All rights reserved. No part of this slide
may be reproduced, stored in a retrieval
system, or transmitted, in any form or by
any means, without the prior permission.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
Data privacy is one of the most critical issues that businesses face. This presentation shares insights on the principles and best practices for ensuring the resilience and security of your workload.
Drawing on a real-life project from the HR industry, the various challenges will be demonstrated: data protection, self-healing, business continuity, security, and transparency of data processing. This systematized approach allowed to create a secure AWS cloud infrastructure that not only met strict compliance rules but also exceeded the client's expectations.
3. Program 2Bytes_pro;
Uses wincrt;
Var k,x,y,z :integer;
Procedure proc1(a:integer; var b:integer ;)
var i,x: integer;
Begin
i:=10; x:=7; y:=12; a:=2; b:=4;
end;
Begin
x:=3; y:=5; proc1(k,z);
Writeln(„z=„,z);
Writeln(„k=„,k);
Writeln(„x=„,x);
Writeln(„y=„,y);
Writeln(„i=„,i);
End.
+1
+1
+1
+1
+1
{ z=4 }
{Random value often be zero}
{ x=3 }
{ y=12 }
{ error }
4. In procedures and functions There are four types of variables :
1.General Variables : are variables that are written at the top of the program befor all procedures and functions and we can see it and deal with it by all procedures and functions in the main program (like : k , x , y , z) .
2.Local Variables : are variables that are declared in the statements part within procedure or function and we can‟t see it and deal with it outside that procedures (like : i , x ) .
3.Formality Variables : are variables that appear in the header of procedure or function and it is formality and is not reserved place for it in memory (like a , b )
we have two types of formality variables
1) input variables : Keeps the value entered by after the completion of the procedural ( like : a)
2)output variables : Keeps the value obtained by the procedure. And we writes before it the reserved word (var) (like : b )
4.Actual Variables : are variables that main program pass it to procedure or function during a summons and it agree formality variables in number and type (like : k , z)
5. Notes :
Local variables have priority from general variables in the same Field of vision ( ايؤرنا لاجي ) ( like : x)
Execution always start form (begin) by the main program
in string :
var : name , lname : string ;
begin writeln(„enter the name and lname „);
readln(name , lname);
writeln(name);
writeln(lname);
End.
Ahmed
Ali
Inputs :
Ahmed Ali
X nothing
outputs
name);
readln(lname);
+1
7. What is a DiscreteType??
Discrete Data Type:
Integer
boolean
char
Enumerated
Day=(sat,sun,mon,tu,wed,th,fri)
Like..
8. Definition
The SET is a Data Structure which contain discrete type elements ..
Doesn‟t have index.!!
<Nameof varible > :Set of < discrete type >
We can‟t define the set as this form :
S : Set of Integer;
Because set can have 256 components at most and all its component values should be in rang 0 .. 255 .
9. Ex:
•S1 : Set of 1..100;
•S2 : Set of „a‟..‟z‟;
•S : Set of Days;
•S : Set of 66..256;
•S: set of char ;
{True}
{True}
{True}
{False}
+1
{True}
10. Set Handling
Var:
s1:set of 0..255;
S2,s3:set of 40..100;
S4:set of „a‟..‟z‟;
19. Operation
•To put a value in it , we use [value] .
•The operations on Sets :
⋂ ⇔ *
⋃ ⇔ +
/ ⇔ -
⊆ ⇔ <=
⊇ ⇔ >=
∈ ⇔ in
20. Program SetsOperator; Var A0 : set of 1..15; A1 : set of 1..10; A2 : set of 5..15; i : integer; Begin A1 := [1..10]; A2 := [5..15]; A0 := A1*A2; {A0=[5..10]} A0 := A1+A2; {A0=[1..15]} A0 := A1-A2; {A0=[1..4]} A0 := A0-[1]; {A0=[2..4]}
21. A1 := [2,3];
A2 := [1,2,3,4,5];
if (A1 <= A2) then {or (A2 >= A1)}
writeln ('A1 is a subset of A2');
readln (i);
if (i in A1) then
writeln (i,' is in A1')
else
writeln (i,' is not in A1');
End;
22. True statement
A0, A1 : Set of 1..15; A : boolean; A0 := [1, 2]; A1 := [2, 4]; A0 := A0 – [77]; A := A1 >= A0; A := 1 in A0;
23. Const Sets
Type
Digits = set of 0..9;
Const
HexD : set of '0'..'z‘ =
['0'..'9', 'A'..'F', 'a'..'f'];
ED : Digits = [0, 2, 4, 6, 8];
Var
d : Digits;
Begin
d := [8];
d := ED; {d=[0,2,4,6,8]}
ED:=ED+[9];
ED:=d;
End.
+1
Error .. Fateh 3eoonk !!
24. Enum Set
Type
Day = (sun,mon,….,sat);
Name=(koko,soso,fofo,fifi);
Var
days: Set of Day;
N:set of Name
Begin
Days:=[sun..sat];
N:=[KOKO,SOSO];
End.
26. Program Test(); Type SInt = Set of 1..150 ; SCh = Set of ‘0’..’z’; Var S1 : SInt; S2 : SCh; Slen : Integer; Begin Readln(Slen); ReadsetI(S1 , Slen); ReadsetC(S2 , Slen); PrintsetI(S1 , Slen); PrintsetC(S2 , Slen); Readln; End.
27. Read Integer Sets
Procedure ReadsetI (var S:SInt; L:integer) ;
var
i, x : integer;
Begin
s:=[];
For i:=1 to L do
begin
Read(x);
S := S + [x];
end;
End;
28. Read Char Sets
Procedure ReadsetC (var S:SCh; L:integer) ; var i, x : Char; Begin s:=[]; For i:=1 to L do begin Read(x); S := S + [x]; end; End;
29. Print Integer Sets Using While Loop:
Procedure PrintsetI (S : SInt) ;
var
I : Integer;
Begin
I := 0;
While ( S <> []) do
If (I in S) then
begin
Writeln(I);
S := S – [I];
end;
I := I + 1;
End;
30. Print Integer Sets Using For Loop
Procedure PrintsetI (S : SI) ; var I : Integer; Begin For I:=1 to 32700 do Begin If (I in S) then Begin Writeln(I); S := S – [I]; End; If (S = []) then I := 32700; End; End;
31. Exercise :
يرى في يؼهذ يا إػطاء دوراخ في يادذي انرياضياخ وانهغح الإ كَهيسيح
يؼطى كم طانة ػ ذُ ذسجيهه في ان ؼًهذ رقى فريذ يحصىر تي 1..100 فإرا ػه دً أ ػذد انطلاب في كم يادج لا يرجاوز 50 طانة
ان طًهىب كراتح تر اَيج ػاو تاسرخذاو الاجرائياخ وان جً ىًػاخ ورنك
نهقياو تان هًاو انرانيح :
.
1 ذشكيم يج ىًػح نطلاب انرياضياخ ويج ىًػح نطلاب انهغح
الإ كَهيسيح )إدخال ػ اُصر ان جً ىًػح (
.
2 إجراء نطثاػح ػ اُصر ان جً ىًػح
.
3 إجراء لإػطاء يج ىًػح تأرقاو انطلاب ان سًجهي تان اًدذي .
4 قررخ إدارج ان ؼًهذ ذخفيض ػذد انطلاب ورنك تالاسرغ اُء ػ ػذد
يحذد ي هُى يذخم ي نىحح ان فًاذيح ػهى أ يرى اخريار أرقاو
انطلاب ان فًصىني تشكم ػشىائي وان طًهىب كراتح إجراء ن قُم
أرقاو انطلاب ان فًصىني إنى يج ىًػح جذيذج
.
5 وضغ أرقاو انطلاب ان فًصىني ض شؼاع
32. Program prog2byte_team;
Uses wincrt;
Type students=set of 1..100;
numbers=array[1..50] of 1..100;
Var seng,smath : students;
Procedure inputset(var s : students; m:integer);
Var i,x: integer;
Begin
s:=[ ];
i:=0;
While (i<m) do
begin
writeln(„input students number „);
readln(x);
if (x in s) then
writeln(„ you input this number befor please enter
another number „)
else
begin
i:=i+1;
s:=s+[x];
end;
end;
End;
numbers of students
33. Procedure printset(s :students);
Var i:integer;
Begin
i:=1;
While (s<>[ ]) do
begin
if (i in s) then
begin
write(i:5);
s:=s-[ i ];
end;
i:=i+1;
end;
writeln;
End;
35. Procedure deletestd(var s,n : students);
Var k,i,x ; integer;
Begin
n:= [ ];
Randomize;
i:=0;
Writeln(„enter the number you want to go throw out „);
Readln(x);
While (i<x) do
begin
k:= random(100) + 1;
if ( k in s ) then
begin
s:=s – [ k ];
seng:= seng – [ k ];
smath:=smath – [ k ];
i:=i+1;
n:=n + [ k ];
end;
end;
End;
بلاطنا حػىًجي
ان فًصىني يج ىًػح
انرقاطغ
:Randomize يقىو ترىنيذ
أرقاو ػشىائيح أػر اًدا ػهى
ساػح ان ظُاو
:Random(100)=0..99;
Random(100)+1=1..100
36. Procedure setinArray(s: students; var a: numbers ; var k: integer);
Var i : integer;
Begin
K:=0;
For i:=1 to 100 do
If (i in s) then
begin
k:=k+1;
a[k]:=i;
end;
End;
ي أجم اسرذػاء
انشؼاع في انثر اَيج
انرئيسي
37. Var nmath,neng,k,i :integer;
Aunaccepted : numbers;
Sunaccepted,sboth : students;
Begin
Writeln(„enter the number of math students „);
Readln(nmath);
Inputset(smath,nmath);
Writeln(„enter the number of English students „);
Readln(neng);
Inputset(seng,neng);
Bothsub(smath , seng , sboth);
Printset(sboth);
Deletestd(sboth,Sunaccepted);
Printset(Sunaccepted);
setinArray(Sunaccepted,Aunaccepted,k);
For i:=1 to k do
Writeln(Aunaccepted[i]:5);
Readln;
End.
38. Homework:
Creat and read two arrays of student numbers, student numbers in Prog and in English.
-We want to know the students numbers at the two subjects..?!
-what are the student numbers at the Prog and Not at English ??
+10 point
39. Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account
2 bytes team
41. Ques:
write a programme DO:
1-Read An Array 2-Print An Array//Proce
3-function to find the min elem in the array
4-Procedure to find the Sum array(of the tow arrays).
5- Multi array
Write the Main Program..
42. Programme P-Matrix;
Const nMax=20; mMax=20;
Type Matrix=array[1..nmax,1..mmax] of real;
Var A,B,Add,mult :Matrix;
n1,n2 :1..nmax;
m1,m2 :1..mmax;
min: integer;
43. Procedure ReadMat(Var: n:1..nmax;var m:1..mmax; var A:matrix);
Var i,j:integer;
begin
writeln(„enter the first Dimention of matrix< ‟ ,nmax);
Readln(n);
writeln(„enter the second Dimention of matrix< ‟ ,mmax);
Readln(m);
for i:=1 to n do
begin
for j:=1 to m do read(A[I,j]); {hint}
readln; {hint}
end;
end;
44. Procedure WriteMat(Var: n:1..nmax;var m:1..mmax; var A:matrix);
Var i,j:integer;
begin
for i:=1 to n do
begin
for j:=1 to m do write(A[i,j],‟ ‟);
writeln;
end;
end;
46. Procedure Add_Tow_Matrix(n1,n2:1..nmax; m1,m2:1..mmax; var n3:1..nmax; var m3:1..mmax; var c:Matrix);
Var i,j:integer;
begin
if(n1<>n2)or(m1<>m2) then
writeln(„the addition is impossible‟);
else
begin
n3:=n1; m3:=m1;
for i:=1 to n3 do
for j:=1 to m3 do
C[i.j]:=A[i,j]+B[i,j];
end;
end;
47. Procedure Mult_Tow_Matrix(n1,n2:1..nmax; m1,m2:1..mmax; var n3:1..nmax; var m3:1..mmax; var c:Matrix);
Var i,j,k:integer;
begin
if(n1<>m2) then
writeln(„the multi is impossible‟);
else
begin
n3:=n2; m3:=m1; { A(m1,n1)*B(m2,n2)=C(m3,n3)}
for i:=1 to n3 do
for j:=1 to m3 do
begin
C[i,j]=0;
for k:=1 to m2
C[i.j]:= C[i.j] +A[i,k]*B[k,j];
end;
end;
end;
48. Begin
ReadMat(n1,m1,A); WriteMat(n1,m1,A);
ReadMat(n2,m2,B); WriteMat(n2,m2,B);
writeln(„the minimum of the first Mat = ‟);
min:=MinOfMatrix(n1,m1,A); writeln(min);
Add_Tow_Matrix(n1.m1,n2,m2,A,B,n3,m3,Add);
WriteMat(n3,m3,Add);
Mult_Tow_Matrix(n1,n2,m1,m2,A,B, n3,m3,mult);
WriteMat(n3,m3,mult);
End;
49. Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account
2 bytes team