Operatii pop si push-stiva

Similar documents
Lucrare pentru colocviu de practică

Lampiran B. Program pengendali

Convertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un

namespace Tst_Form { private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components;

#pragma comment(lib, "irrklang.lib") #include <windows.h> namespace SuperMetroidCraft {

Lucrare pentru colocviul de practica informatica an II calculatoare COTFAS VLAD CALC 2

Classes in C# namespace classtest { public class myclass { public myclass() { } } }

User-Defined Controls

1. Windows Forms 2. Event-Handling Model 3. Basic Event Handling 4. Control Properties and Layout 5. Labels, TextBoxes and Buttons 6.

Tutorial 5 Completing the Inventory Application Introducing Programming

Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic

Managed C++ and.net Development STEPHEN R. G. FRASER

This is the start of the server code

Sub To Srt Converter. This is the source code of this program. It is made in C# with.net 2.0.

CSC 211 Intermediate Programming

ListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list

Inheriting Windows Forms with Visual C#.NET

Exemplu pentru utilizarea metodelor grafice

Visual Studio Windows Form Application #1 Basic Form Properties

IBSDK Quick Start Tutorial for C# 2010

APARAT DE MASURA. Descrierea programului

Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects

Web Services in.net (2)

Avoiding KeyStrokes in Windows Applications using C#

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1

LISTING PROGRAM. //Find the maximum and minimum values in the array int maxvalue = integers[0]; //start with first element int minvalue = integers[0];

Ballbot. Scott Pokorny. EML 5666 Intelligent Machines Design Lab. Instructors: Dr. A. Antonio Arroyo and Dr. Eric M. Schwartz

C# and.net (1) cont d

PS2 Random Walk Simulator

In order to create your proxy classes, we have provided a WSDL file. This can be located at the following URL:

Blank Form. Industrial Programming. Discussion. First Form Code. Lecture 8: C# GUI Development

CSC 330 Object-Oriented Programming. Encapsulation

CIS 3260 Sample Final Exam Part II

CHAPTER 3. Writing Windows C# Programs. Objects in C#

Rezolvare fişă de laborator Java Iniţiere în limbajul Java

CALCULATOR APPLICATION

CSIS 1624 CLASS TEST 6

UNIT-3. Prepared by R.VINODINI 1

Arrays. Arrays: Declaration and Instantiation. Array: An Array of Simple Values

Polymorphism. Polymorphism. CSC 330 Object Oriented Programming. What is Polymorphism? Why polymorphism? Class-Object to Base-Class.

Flag Quiz Application

this.openfiledialog = new System.Windows.Forms.OpenFileDialog(); this.label4 = new System.Windows.Forms.Label(); this.

#using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll>

if (say==0) { k.commandtext = "Insert into kullanici(k_adi,sifre) values('" + textbox3.text + "','" + textbox4.text + "')"; k.

Laborator 3 Aplicatii Java

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

Start Visual Studio and create a new windows form application under C# programming language. Call this project YouTube Alarm Clock.

Tehnici avansate de programare

using namespace System::Drawing::Drawing2D; using namespace System::Collections::Generic;

Se cer 2 variante: una cu implementarea statica si a doua cu implementarea dinamica a structurilor de date necesare. Comentati variantele.

First start a new Windows Form Application from C# and name it Interest Calculator. We need 3 text boxes. 4 labels. 1 button

Laborator 5 Instrucțiunile repetitive

Fişiere in C++ Un fişier este o colecţie de date indicat printr-un nume şi o extensie. Numele este desparţit de extensie prin punct.

An array can hold values of any type. The entire collection shares a single name

BackgroundWorker Component Overview 1 Multithreading with the BackgroundWorker Component 3 Walkthrough Running an Operation in the Background 10 How

Create your own Meme Maker in C#

Chapter 6 Dialogs. Creating a Dialog Style Form

For this example, we will set up a small program to display a picture menu for a fast food take-away shop.

Chapter 2 Visual Basic, Controls, and Events. 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual Basic Events

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below.

Chapter 12: Using Controls

Web Services in.net (7)

EEE-425 Programming Languages (2013) 1

Chapter 12 - Graphical User Interface Concepts: Part 1

Using the Quinn-Curtis.Net Software (QCChart2D and QCRTGraph) with Managed C++ (MC++)

Given the C++ declaration statement below, which of the following represents the value of exforsys? e) None of the above. 1K

Visual C# Program: Simple Game 3

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them.

Laborator 3 Java. Introducere in programarea vizuala

Now find the button component in the tool box. [if toolbox isn't present click VIEW on the top and click toolbox]

EEE-425 Programming Languages (2013) 1

Database Programming in Visual Basic.NET

You can call the project anything you like I will be calling this one project slide show.

Utilizarea formularelor in HTML

Visual Basic/C# Programming (330)

Experiment 5 : Creating a Windows application to interface with 7-Segment LED display


We are going to use some graphics and found a nice little batman running GIF, off course you can use any image you want for the project.

// Specify SEF file to load. oschema = (edischema) oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

Web Services in.net (6) cont d

Nano River Technologies April 2009

The Microsoft.NET Framework

The Payroll User Interface: MODEL VIEW PRESENTER

REVIEW OF CHAPTER 1 1

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer

SMITE API Developer Guide TABLE OF CONTENTS

Event-based Programming

Capturing the Mouse. Dragging Example

Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK.

Laborator 8 Java Crearea claselor de obiecte. Variabilele (campurile) clasei de obiecte

Classes and Objects. Andrew Cumming, SoC. Introduction to.net. Bill Buchanan, SoC. W.Buchanan (1)

Visual Studio.NET enables quick, drag-and-drop construction of form-based applications

Tipuri de date structurate

// Specify SEF file to load. edischema oschema = oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

Classes and Objects. Andrew Cumming, SoC. Introduction to.net. Bill Buchanan, SoC. W.Buchanan (1)

Object oriented lab /second year / review/lecturer: yasmin maki

Menus. You ll find MenuStrip listed in the Toolbox. Drag one to your form. Where it says Type Here, type Weather. Then you ll see this:

Chapter 12. Tool Strips, Status Strips, and Splitters

SECTION 5 L1 - Group By and Having Clauses

NI USB-TC01 Thermocouple Measurement Device

Transcription:

Operatii pop si push-stiva Aplicatia realizata in Microsoft Visual Studio C++ 2010 permite simularea operatiilor de introducere si extragere a elementelor dintr-o structura de tip stiva.pentru aceasta am folosit doua butoane care permit introducerea si extragerea elementelor.utilizatorul trebuie sa introduca capacitatea maxima a stivei precum si elementele care se vor introduce.in cazul in care stiva e plina va aparea un mesaj de eroare si nu se vor mai putea introduce alte elemente.totodata in cazul in care dorim sa stergem un element dar nu avem niciunul in stiva, utilizatorul va fi anuntat ca stiva e goala si ca defapt acesta incearca sa stearga un element care nu exista.stergerea elementelor presupune defapt desenarea peste element a unui dreptunghi de culoarea backgroundului.

Codul sursa: #pragma once namespace incercare_stergeredesen using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing;

/ <summary> / Summary for Form1 / </summary> public ref class Form1 : public System::Windows::Forms::Form public: Form1(void) InitializeComponent(); TODO: Add the constructor code here protected: / <summary> / Clean up any resources being used. / </summary> ~Form1() if (components) delete components; private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::Button^ button2; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::TextBox^ textbox1; protected: private: / <summary> / Required designer variable. / </summary> System::ComponentModel::Container ^components; static System::Drawing::Graphics^ Desen; static System::Drawing::SolidBrush^ Pensula; static System::Drawing::SolidBrush^ Pensula1; static System::Drawing::Pen^ Creion_rosu; static int i=1,nr,h,j,maxd=0,h2,k=1,m=0,l; static int max; static array < int >^ numere = gcnew array < int > (30); private: System::Windows::Forms::Label^ label2; private: System::Windows::Forms::TextBox^ textbox2; #pragma region Windows Form Designer generated code / <summary>

/ Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> void InitializeComponent(void) this->button1 = (gcnew System::Windows::Forms::Button()); this->button2 = (gcnew System::Windows::Forms::Button()); this->label1 = (gcnew System::Windows::Forms::Label()); this->textbox1 = (gcnew System::Windows::Forms::TextBox()); this->label2 = (gcnew System::Windows::Forms::Label()); this->textbox2 = (gcnew System::Windows::Forms::TextBox()); this->suspendlayout(); button1 this->button1->forecolor = System::Drawing::Color::Red; this->button1->location = System::Drawing::Point(416, 12); this->button1->name = L"button1"; this->button1->size = System::Drawing::Size(75, 48); this->button1->tabindex = 0; this->button1->text = L"Adauga element in stiva"; this->button1->usevisualstylebackcolor = true; this->button1->click += gcnew System::EventHandler(this, &Form1::button1_Click); button2 this->button2->location = System::Drawing::Point(416, 79); this->button2->name = L"button2"; this->button2->size = System::Drawing::Size(75, 58); this->button2->tabindex = 1; this->button2->text = L"Sterge element din stiva"; this->button2->usevisualstylebackcolor = true; this->button2->click += gcnew System::EventHandler(this, &Form1::button2_Click); label1 this->label1->autosize = true; this->label1->font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast<system::byte>(0))); this->label1->location = System::Drawing::Point(12, 47); this->label1->name = L"label1"; this->label1->size = System::Drawing::Size(136, 15); this->label1->tabindex = 2; this->label1->text = L"Introduceti numarul:"; textbox1 this->textbox1->location = System::Drawing::Point(154, 46); this->textbox1->name = L"textBox1"; this->textbox1->size = System::Drawing::Size(100, 20); this->textbox1->tabindex = 3;

label2 this->label2->autosize = true; this->label2->font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast<system::byte>(0))); this->label2->location = System::Drawing::Point(13, 14); this->label2->name = L"label2"; this->label2->size = System::Drawing::Size(261, 15); this->label2->tabindex = 4; this->label2->text = L"Introduceti capacitatea maxima a stivei:"; textbox2 this->textbox2->location = System::Drawing::Point(280, 13); this->textbox2->name = L"textBox2"; this->textbox2->size = System::Drawing::Size(100, 20); this->textbox2->tabindex = 5; Form1 this->autoscaledimensions = System::Drawing::SizeF(6, 13); this->autoscalemode = System::Windows::Forms::AutoScaleMode::Font; this->backcolor = System::Drawing::Color::White; this->clientsize = System::Drawing::Size(503, 350); this->controls->add(this->textbox2); this->controls->add(this->label2); this->controls->add(this->textbox1); this->controls->add(this->label1); this->controls->add(this->button2); this->controls->add(this->button1); this->forecolor = System::Drawing::Color::Black; this->name = L"Form1"; this->text = L"Form1"; this->load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::Form1_Paint); this->resize += gcnew System::EventHandler(this, &Form1::Form1_Resize); this->resumelayout(false); this->performlayout(); #pragma endregion /*private: System::Void button1_click(system::object^ sender, System::EventArgs^ e) Desen = this->creategraphics(); Pensula=gcnew System::Drawing::SolidBrush(System::Drawing::Color::DarkOrchid ); System::Drawing::Font^ font_nina; font_nina=gcnew System::Drawing::Font("Nina",10); try max=int::parse(this->textbox2->text);

h=this->height-50; if(this->textbox1->text!=" " && maxd!=max) Desen->DrawString(this->textBox1->Text,font_nina,Pensula,65,h-i*25); numere[m]=int::parse(this->textbox1->text); m++; i++; maxd++; else MessageBox::Show("Stiva plina"); catch(...) MessageBox::Show("Introduce-ti valori numerice!"); j=i-1; l=m-1; private: System::Void button2_click(system::object^ sender, System::EventArgs^ e) h=this->height-50; if(maxd!=0) Pensula1=gcnew System::Drawing::SolidBrush(System::Drawing::Color::White ); Desen->FillRectangle(Pensula1, 65,h-j*25,65,15); numere[l]=0; l--; m--; j--; i--; maxd--;

else MessageBox::Show("Stiva goala"); private: System::Void Form1_Resize(System::Object^ sender, System::EventArgs^ e) Desen->Clear(System::Drawing::Color(this->BackColor)); Pensula=gcnew System::Drawing::SolidBrush(System::Drawing::Color::DarkOrchid ); System::Drawing::Font^ font_nina; font_nina=gcnew System::Drawing::Font("Nina",10); Creion_rosu=gcnew System::Drawing::Pen(System::Drawing::Color::Red,10); h2=this->height-80; for(k=0; k<m; k++) Desen- >DrawString(System::Convert::ToString(numere[k]),font_nina,Pensula,65,h2-k*25); private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) Desen = this->creategraphics(); Creion_rosu=gcnew System::Drawing::Pen(System::Drawing::Color::Red,10); h2=this->height-50; Desen->DrawLine(Creion_rosu,50,60,50, h2); Desen->DrawLine(Creion_rosu,200,60,200,h2 ); Desen->DrawLine(Creion_rosu,45,h2,205,h2 ); private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) ; */