Skip to content

Instantly share code, notes, and snippets.

@mojombo
Created July 17, 2008 20:37
Show Gist options
  • Select an option

  • Save mojombo/15 to your computer and use it in GitHub Desktop.

Select an option

Save mojombo/15 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
#include "stog_pokazivaci.h"
//#include "stog_polje.h"
int kraj_rek;
bool print;
void unosi(stog *Stog_m) {
elementtype dod;
int n;
cout<<"Koliko automobil zelite unesti?" <<endl;
cin >> n;
for (int i=0;i<n;i++){
cout<<"Unesite serijski broj automobila: "<<endl;
cin>>dod.serijski_broj;
cout<<"Unesite proizvodaca automobila: "<<endl;
cin>>dod.proizvodac;
cout<<"Unesite model automobila: "<<endl;
cin>>dod.model_automobila;
do{
cout<<"Unesite godinu proizvodnje automobila: "<<endl;
cin>>dod.godina_proizvodnje;
if (dod.godina_proizvodnje < 1995 || dod.godina_proizvodnje > 2010){
cout << "Pogresan unos!" << endl;
cout << "Godina mora biti u rasponu 1995-2010!" << endl;
cout << "Molim vas ponovite!" << endl;}
} while (dod.godina_proizvodnje < 1995 || dod.godina_proizvodnje > 2010);
cout << "~~~~~~Uneseni automobil uspjesno je spremljen u skladiste!!~~~~~~" << endl;
PushS(dod, Stog_m);
}
}
void ispis1 (stog *Stog_m,stog *Stog_m_mov){
cout << "--------------------Iskrcaj automobila--------------------"<<endl;
cout << "----------------------------------------------------------"<< endl;
cout << "Proizvodac" << "\t" << "Model automobila" << "\t" << "Godina proizvodnje" << "\t" << endl;
cout <<"----------" << "\t" << "----------------" << "\t" << "------------------" << "\t" << endl;
while ( IsEmptyS(Stog_m)==0 ){
if (TopS(Stog_m).godina_proizvodnje>2006 && strcmp(TopS(Stog_m).proizvodac,"audi")){
cout<< TopS(Stog_m).proizvodac<<"\t\t"<<TopS(Stog_m).model_automobila<<"\t\t\t"<<TopS(Stog_m).godina_proizvodnje<<"\t\t"<<endl;
PopS(Stog_m); }
else {
PushS( TopS(Stog_m), Stog_m_mov);
PopS(Stog_m);
}
};
cout << "----------------------------------------------------------"<<endl;
cout << endl;
cout << "Automobili su uspjesno iskrcani!!" << endl;
cout << endl;
cout << endl;
cout << "-------------------Preostali automobili-------------------"<< endl;
cout << "----------------------------------------------------------"<<endl;
cout << "Proizvodac" << "\t" << "Model automobila" << "\t" << "Godina proizvodnje" << "\t" << endl;
cout <<"----------" << "\t" << "----------------" << "\t" << "------------------" << "\t" << endl;
while ( IsEmptyS(Stog_m_mov)==0 ){
PushS( TopS(Stog_m_mov), Stog_m);
cout<<TopS(Stog_m).proizvodac<<"\t\t"<<TopS(Stog_m).model_automobila<<"\t\t\t"<<TopS(Stog_m).godina_proizvodnje<<"\t\t "<<endl;
PopS(Stog_m_mov);
}
cout <<"----------------------------------------------------------" << endl;
}
int ispis2(stog *Stog_m){
elementtype dod;
dod=TopS(Stog_m);
if (!strcmp(dod.proizvodac,"audi")) {
cout << "-----------------------------------"<<endl;
cout << "Iskrcaj automobila marke Audi: " << endl;
cout << "Model: " <<dod.model_automobila << endl;
cout << "Godina proizvodnje: " <<dod.godina_proizvodnje<<endl;
cout<< "-----------------------------------" <<endl;}
PopS(Stog_m);
if (!IsEmptyS(Stog_m) || kraj_rek) ispis2 (Stog_m);
kraj_rek = true;
if (strcmp(dod.proizvodac,"audi")){
PushS(dod, Stog_m);
if (print==false){
cout << endl;
cout << "-------------------Preostali automobili-------------------"<< endl;
cout << "----------------------------------------------------------"<<endl;
cout << "Proizvodac" << "\t" << "Model automobila" << "\t" << "Godina proizvodnje" << "\t" << endl;
print=true;
};
cout<<dod.proizvodac<<"\t\t"<<dod.model_automobila<<"\t\t\t"<<dod.godina_proizvodnje<<endl;
}
}
int main(){
int izbor;
stog *Stog_m, *Stog_m_mov;
Stog_m=InitS();
Stog_m_mov=InitS();
do{
cout << "-------------------------------------------------" << endl;
cout << "1. Dodavanje zapisa o automobilima" << endl;
cout << "2. Ispis automobila marke!=Audi" << endl;
cout << "3. Ispis automobila marke==Audi (rekruzije)" << endl;
cout << "9. izlaz "<<endl;
cout << "-------------------------------------------------" << endl;
cout << "Vas izbor je: " << endl;
cin>>izbor;
cout << endl;
switch(izbor){
case 1: unosi(Stog_m);
break;
case 2: ispis1 (Stog_m,Stog_m_mov);
break;
case 3: ispis2 (Stog_m);
break;
}
}while (izbor !=9);
system("pause");
return 1;
}
struct auti {
double serijski_broj;
char proizvodac [20];
char model_automobila[20];
int godina_proizvodnje;
};
typedef auti elementtype;
struct smth {
elementtype vrijednosti[5000];
int vrh;
};
typedef struct smth stog;
void PushS(elementtype z, stog *L){
if(L->vrh==-1){
cout<<"Doslo je do pogreske!! Stog je pun!!"<<endl;
exit(1);
};
L->vrijednosti[L->vrh]=z;
L->vrh--;
};
elementtype TopS(stog *L){
if(L->vrh==4999){
cout<<"Doslo je do pogreske!! Stog je prazan!!"<<endl;
exit(1);
}
return L->vrijednosti[L->vrh+1];
};
int IsEmptyS(stog *L){
if(L->vrh==4999) return 1;
else return 0;
};
void PopS(stog *L){
if(L->vrh==4999){
cout<<"Doslo je do pogreske!! Stog je prazan!!"<<endl;
exit(1);
};
L->vrh++;
};
stog * InitS(void){
stog *L;
L=(stog *)malloc(sizeof(stog));
L->vrh=4999;
return L;
};
struct auti {
double serijski_broj;
char proizvodac [30];
char model_automobila[30];
int godina_proizvodnje;
};
typedef auti elementtype;
struct smth{
elementtype vrijednost;
struct smth *slijedeci;
};
typedef struct smth stog;
void PushS(elementtype z, stog *L){
stog *novi;
novi=(stog *)malloc(sizeof(stog));
novi->vrijednost=z;
novi->slijedeci=L->slijedeci;
L->slijedeci=novi;
};
elementtype TopS(stog *L){
stog *vrh;
if(L->slijedeci==NULL){
cout<<"Doslo je do pogreske!! Stog je prazan!!"<<endl;
exit(1);
};
vrh=L->slijedeci;
return vrh->vrijednost;
};
void PopS(stog *L){
stog *pri;
if(L->slijedeci==NULL){
cout<<"Doslo je do pogreske!! Stog je prazan"<<endl;
exit(1);
};
pri=L->slijedeci;
L->slijedeci=pri->slijedeci;
free(pri);
};
int IsEmptyS(stog *L){
if(L->slijedeci==NULL) return 1;
else return 0;
};
stog * InitS(void){
stog *L;
L=(stog *)malloc(sizeof(stog));
// L->vrijednost=0;
L->slijedeci=NULL;
return L;
};
@almirdeoliveiranakao-web

-- Painel Admin Brookhaven v3.1 (Delta)
local Players = game:GetService("Players")
local LP = Players.LocalPlayer
local TweenService = game:GetService("TweenService")

-- Interface
local ScreenGui = Instance.new("ScreenGui", game.CoreGui)
local Main = Instance.new("Frame", ScreenGui)
Main.Size = UDim2.new(0, 250, 0, 220)
Main.Position = UDim2.new(0.5, -125, 0.3, 0)
Main.BackgroundColor3 = Color3.fromRGB(25,25,25)
Main.Active = true
Main.Draggable = true

-- Título
local Title = Instance.new("TextLabel", Main)
Title.Size = UDim2.new(1,0,0,30)
Title.Text = "Admin Sik Brookhaven"
Title.TextColor3 = Color3.new(1,1,1)
Title.BackgroundColor3 = Color3.new(0,0,0)

-- Dropdown
local Drop = Instance.new("TextButton", Main)
Drop.Size = UDim2.new(0.9,0,0,30)
Drop.Position = UDim2.new(0.05,0,0.2,0)
Drop.Text = "Selecionar Player"
Drop.BackgroundColor3 = Color3.fromRGB(50,50,50)

local Lista = Instance.new("ScrollingFrame", Main)
Lista.Size = UDim2.new(0.9,0,0,100)
Lista.Position = UDim2.new(0.05,0,0.35,0)
Lista.BackgroundColor3 = Color3.fromRGB(30,30,30)
Lista.ScrollBarThickness = 4
Lista.Visible = false

-- Botões
local BtKill = Instance.new("TextButton", Main)
BtKill.Size = UDim2.new(0.28,0,0,30)
BtKill.Position = UDim2.new(0.05,0,0.75,0)
BtKill.Text = "Kill"
BtKill.BackgroundColor3 = Color3.fromRGB(255,0,0)

local BtKick = Instance.new("TextButton", Main)
BtKick.Size = UDim2.new(0.28,0,0,30)
BtKick.Position = UDim2.new(0.36,0,0.75,0)
BtKick.Text = "Kick"
BtKick.BackgroundColor3 = Color3.fromRGB(255,100,0)

local BtJump = Instance.new("TextButton", Main)
BtJump.Size = UDim2.new(0.28,0,0,30)
BtJump.Position = UDim2.new(0.67,0,0.75,0)
BtJump.Text = "Jumpscare"
BtJump.BackgroundColor3 = Color3.fromRGB(150,0,255)

-- Atualiza lista
local function Atualiza()
for _,v in pairs(Lista:GetChildren()) do if v:IsA("TextButton") then v:Destroy() end end
for i,p in pairs(Players:GetPlayers()) do
local btn = Instance.new("TextButton", Lista)
btn.Size = UDim2.new(1,0,0,25)
btn.Position = UDim2.new(0,0,0,25*(i-1))
btn.Text = p.Name
btn.BackgroundTransparency = 1
btn.TextColor3 = Color3.new(1,1,1)
btn.MouseButton1Down:Connect(function()
Drop.Text = p.Name
Lista.Visible = false
end)
end
end
Atualiza()
Players.PlayerAdded:Connect(Atualiza)
Players.PlayerRemoving:Connect(Atualiza)

Drop.MouseButton1Down:Connect(function() Lista.Visible = not Lista.Visible end)

-- Funções
local alvo = function() return Players:FindFirstChild(Drop.Text) end

BtKill.MouseButton1Down:Connect(function()
local t = alvo()
if t and t.Character and t.Character:FindFirstChild("Head") then
local ex = Instance.new("Explosion", workspace)
ex.Position = t.Character.Head.Position
ex.BlastRadius = 0
ex.DestroyJointRadiusPercent = 1
end
end)

BtKick.MouseButton1Down:Connect(function()
local t = alvo()
if t and t.Character and t.Character:FindFirstChild("HumanoidRootPart") then
for i=1,5 do
t.Character.HumanoidRootPart.CFrame = CFrame.new(0, 50000, 0)
wait(0.1)
end
end
end)

BtJump.MouseButton1Down:Connect(function()
local s = Instance.new("Sound", LP.PlayerGui)
s.SoundId = "rbxassetid://138186576"
s.Volume = 5
s:Play()
local f = Instance.new("Frame", LP.PlayerGui)
f.Size = UDim2.new(2,0,2,0)
f.Position =

UDim2.new(-0.5,0,-0.5,0)

f.BackgroundColor3 = Color3.new(1,0,0)
f.BackgroundTransparency = 0
TweenService:Create(f, TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true), {BackgroundTransparency = 1}):Play()
wait(0.4)
f:Destroy()

end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment