memset(*reinterpret_cast<void **>(0x74872D), 0x90, 9);
memset(reinterpret_cast<void *>(0x74872D), 0x90, 9);memset(*reinterpret_cast<void **>(0x74872D), 0x90, 9);
memset(reinterpret_cast<void *>(0x74872D), 0x90, 9);char *p = new char[128];
strcat(p, "123123123123123123123123123123123123");
printf("%s\n", p);
delete[] p;
printf("%s\n", p);
p = nullptr;
int num; // размер массива
cout << "Enter integer value: ";
cin >> num; // получение от пользователя размера массива
int *p_darr = new int[num]; // Выделение памяти для массива
for (int i = 0; i < num; i++) {
// Заполнение массива и вывод значений его элементов
p_darr[i] = i;
cout << "Value of " << i << " element is " << p_darr[i] << endl;
}
delete [] p_darr; // очистка памяти
delete и не должен ничего чистить. Он вызывает деструктор и потом freeпочему p не чистится после delete[] p; ?C++:char *p = new char[128]; strcat(p, "123123123123123123123123123123123123"); printf("%s\n", p); delete[] p; printf("%s\n", p); p = nullptr;
если гуглить динамические массивы, то по первой же ссылке будет:
Посмотреть вложение 92469C++:int num; // размер массива cout << "Enter integer value: "; cin >> num; // получение от пользователя размера массива int *p_darr = new int[num]; // Выделение памяти для массива for (int i = 0; i < num; i++) { // Заполнение массива и вывод значений его элементов p_darr[i] = i; cout << "Value of " << i << " element is " << p_darr[i] << endl; } delete [] p_darr; // очистка памяти
код репаира кара если можно
ну так перенеси из собейта. В чем твоя проблема?Есть у кого-нибудь адрес onfoot рейтов для r3 сампа? Нашел в собейте, но в апи лучара нету
Я нашел собейт только для r1 версии сампану так перенеси из собейта. В чем твоя проблема?
как работает этот плагин? как-то очищает буфер при каждом реконнекте?![]()
Reset remove building count
Убирает краш, связанный с переполнением буфера RPC_ScrRemoveBuildingForPlayer, при частых переподключениях.www.blast.hk
void __cdecl __noreturn patch()
{
HMODULE sampaddr; // esi
DWORD prot; // [esp-8h] [ebp-20h]
DWORD flOldProtect; // [esp+Ch] [ebp-Ch] BYREF
DWORD flNewProtect; // [esp+10h] [ebp-8h] BYREF
for ( sampaddr = GetModuleHandleA("samp.dll"); !sampaddr; sampaddr = GetModuleHandleA("samp.dll") )
Sleep(1000u);
VirtualProtect((LPVOID)0x7BA917, 0xDu, 0x40u, &flOldProtect);
MEMORY[0x7BA917] = '%\x83';
MEMORY[0x7BA919] = sampaddr + '\x04\xEEV';
MEMORY[0x7BA91D] = '\xC5\x8E\x8B\0';
MEMORY[0x7BA921] = '\x03';
MEMORY[0x7BA923] = '\0';
VirtualProtect((LPVOID)0x7BA917, 2u, flOldProtect, 0);
VirtualProtect((LPVOID)0x7BA924, 5u, 0x40u, &flNewProtect);
MEMORY[0x7BA925] = (char *)sampaddr + 0xFF84F80E;
MEMORY[0x7BA924] = '\xE9';
VirtualProtect((LPVOID)0x7BA924, 5u, flNewProtect, 0);
VirtualProtect((char *)sampaddr + 0xA131, 6u, 0x40u, &flNewProtect);
prot = flNewProtect;
*((_BYTE *)sampaddr + 0xA131) = '\xE9';
*(_DWORD *)((char *)sampaddr + 0xA132) = 0x7BA912 - ((_DWORD)sampaddr + 0xA131);
*((_BYTE *)sampaddr + 0xA136) = '\x90';
VirtualProtect((char *)sampaddr + 0xA131, 6u, prot, 0);
FreeLibraryAndExitThread(hLibModule, 0);
}
Посмотри реализацию односвязного списка, сразу всё поймёшь.есть структура данных типа стек, нужно заполнить его целыми числами до n-го, вывести, вырезать чётные элементы, и опять вывести.
не смог найти годных статей, потому обращаюсь сюда, был бы благодарен за помощь.
есть структура данных типа стек, нужно заполнить его целыми числами до n-го, вывести, вырезать чётные элементы, и опять вывести.
не смог найти годных статей, потому обращаюсь сюда, был бы благодарен за помощь.
C++:struct stack { int data; stack* next; };
#include <bits/stdc++.h>
using namespace std;
#define MAX 10
class Stack {
int top;
public:
int a[MAX];
Stack() { top = -1; }
bool push(int x);
int pop();
int peek();
bool isEmpty();
};
bool Stack::push(int x)
{
if (top >= (MAX - 1)) {
return false;
}
else {
a[++top] = x;
cout << "push " << x << "\n";
return true;
}
}
int Stack::pop()
{
if (top < 0) {
return 0;
}
else {
int x = a[top--];
return x;
}
}
int Stack::peek()
{
if (top < 0) {
return 0;
}
else {
int x = a[top];
return x;
}
}
bool Stack::isEmpty()
{
return (top < 0);
}
int main()
{
class Stack stackInst;
// заполняем стак
for(size_t i = 0; i < MAX; i++)
{
stackInst.push(i);
}
// избавляемся от четных элементов стака
class Stack stackBuffer;
while (!stackInst.isEmpty())
{
int val = stackInst.peek();
stackInst.pop();
if (val % 2 == 1)
stackBuffer.push(val);
}
while (!stackBuffer.isEmpty())
{
stackInst.push(stackBuffer.peek());
stackBuffer.pop();
}
// стак на выходе
cout << "current stack data: ";
while(!stackInst.isEmpty())
{
cout<<stackInst.peek()<<" ";
stackInst.pop();
}
return 0;
}
/*
output:
push 0
push 1
push 2
push 3
push 4
push 5
push 6
push 7
push 8
push 9
push 9
push 7
push 5
push 3
push 1
push 1
push 3
push 5
push 7
push 9
current stack data: 9 7 5 3 1
*/
это не стек, а linked liststruct stack { int data; stack* next; };
Что это за треш, думаю не стоит приводить в пример такую ебанутую реализациючтобы не мучать голову со своим классом стака(если не требуется создавать его самому) - то используй std::stackstack imp:#include <bits/stdc++.h> using namespace std; #define MAX 10 class Stack { int top; public: int a[MAX]; Stack() { top = -1; } bool push(int x); int pop(); int peek(); bool isEmpty(); }; bool Stack::push(int x) { if (top >= (MAX - 1)) { return false; } else { a[++top] = x; cout << "push " << x << "\n"; return true; } } int Stack::pop() { if (top < 0) { return 0; } else { int x = a[top--]; return x; } } int Stack::peek() { if (top < 0) { return 0; } else { int x = a[top]; return x; } } bool Stack::isEmpty() { return (top < 0); } int main() { class Stack stackInst; // заполняем стак for(size_t i = 0; i < MAX; i++) { stackInst.push(i); } // избавляемся от четных элементов стака class Stack stackBuffer; while (!stackInst.isEmpty()) { int val = stackInst.peek(); stackInst.pop(); if (val % 2 == 1) stackBuffer.push(val); } while (!stackBuffer.isEmpty()) { stackInst.push(stackBuffer.peek()); stackBuffer.pop(); } // стак на выходе cout << "current stack data: "; while(!stackInst.isEmpty()) { cout<<stackInst.peek()<<" "; stackInst.pop(); } return 0; } /* output: push 0 push 1 push 2 push 3 push 4 push 5 push 6 push 7 push 8 push 9 push 9 push 7 push 5 push 3 push 1 push 1 push 3 push 5 push 7 push 9 current stack data: 9 7 5 3 1 */