Bashkangjitur nje zip-folder qe permban nje detyre C++ per lexim dhe mesim
nga kursi C++ i Tirana Center of Technology
TCT Community
Bashkangjitur nje zip-folder qe permban nje detyre C++ per lexim dhe mesim
nga kursi C++ i Tirana Center of Technology
Programim C++ detyre, krijim dhe testing i nje double list link
Tirana Center of Technology
—————————driver.cpp———————-
//driver.cpp
//written to test doubly-linked list ADT
//ItemType must have << and >> operators defined
#include <fstream>
#include <iostream>
#include <string>
#include “sortlist.h”
using namespace std;
template <class ItemType>
void PrintAscending(ostream& dataFile, SortedType<ItemType>& list, string listName);
//pre: list has been initialized
// dataFile is open for output
//post: each component in list has been written to dataFile
// dataFile is still open
template <class ItemType>
void PrintDescending(ostream& dataFile, SortedType<ItemType>& list, string listName);
//pre: list has been initialized
// dataFile is open for output
//post: each component in list has been written, in reverse order, to dataFile
// dataFile is still open
void DisplayMenu(int& choice);
//pre: listA and listB have been initialized
//post: displays a menu for list operations
template <class ItemType>
void Insert(SortedType<ItemType>& list, string listName);
//pre: list has been initialized
// item to insert is entered by the user in the function
//post: Calls the ADT InsertItem and prints a message indicating
// success or failure
template <class ItemType>
void Delete(SortedType<ItemType>& list, string listName);
//pre: list has been initialized
// item to delete is entered by the user within the function
//post: Calls the ADT delete function and prints a message
// indicating success or failure.
template <class ItemType>
void Retrieve(SortedType<ItemType> list);
//pre: none
//post: prompts user for item to retrieve from list; displays message
// indicating whether or not item was found in the list
int main()
{
SortedType<int> listA, listB, listC;
int choice;
Continue reading “Detyra (3) Double Link List (ADT)”
Ne programin C++ bashkengjitur e ndertuar si detyre mesohen thirrjet e funksioneve ne nje program te nivelit mesatar. Programi tregon kohen e pritjes per meshkujt dhe per femrat per te perdorur VC publike.
cfunksionet-detyra-program.rar
Tirana Center of Technology
——–driver.cpp———————-
#include<string>
#include<iostream>
#include<fstream>
//the library when we use the clock and random number function
#include “Patron.h”
#include “Restroom.h”
#include “Input.h”
#include “Output.h”
#include “assign6.h”
using namespace std;
int main()
{
ofstream fout;
fout.open(“output.dat”);
int counter = 0;
do
{
//output
Output simOutputs;
simOutputs.numMenAttendingRest = 0;
simOutputs.numWomenAttendingRest = 0;
simOutputs.numMenUseRest = 0;
simOutputs.numWomenUseRest = 0;
simOutputs.totalMenWaitTime = 0;
simOutputs.totalWomenWaitTime = 0;
simOutputs.menLine = 0;
simOutputs.womenLine = 0;
Input simInputs;
int clock = 0;
double arrivalProbM, arrivalProbF;
Patron pF, pM;
getInput(simInputs, counter);
Restroom womenRoom(simInputs.numFemaleStalls), menRoom(simInputs.numMaleStalls);
arrivalPropability(simInputs, arrivalProbM, arrivalProbF);
for (clock; clock < simInputs.eventLength; clock++)
{
checkFemaleArrival(arrivalProbF, womenRoom, clock, pF, simOutputs);
checkMaleArrival(arrivalProbM, menRoom, clock, pM, simOutputs);
womenRoom.updateStalls();
menRoom.updateStalls();
femaleStallAvailable(womenRoom, pF, clock, simOutputs);
maleStallAvailable(menRoom, pM, clock, simOutputs);
}
//yetInLine(simOutputs);
displayOutput(counter, simInputs, simOutputs, menRoom, womenRoom);
}while(reGetInput());
fout.close();
return 0;
}
————————————————————
Bashkengjitur gjendet nje program C++ ndertuar si detyre. Programi krijon nje klase queue dhe teston operacionet SHTO dhe FSHI.
Tirana Center of Technology
—————driver.cpp—————————-
#include<iostream>
#include<fstream>
#include<string>
#include “Queue1.h”
using namespace std;
void printQue(ostream& fout, QueType<ItemType> q, string queName);
//pre: que has been initilized, fout is open for output
//post: each element of que has been written to datafile
void displayMenu(int& choice);
//pre: none
//post: displays the menu for the user to run operations on several queues
void addElement(QueType<ItemType>& q, string queName);
//pre: none
//post: if queue is not full, a user-entered item is added to queue
// if queue is full a message is displayed
void deleteElement(QueType<ItemType>& q, string queName);
//pre: none
//post: if que is not empty deletes an item from the queue and displayed
// if que is empty a “que is empty” message is displayed
int main()
{
int size;
int choice;
cout<<“Enter the size of the queue2″<<endl;
cin>>size;
QueType<ItemType> que2(size);
QueType<ItemType> que1;