Держи простенький класс, думаю на первое время тебе его хватит.как отправлять http запросы? желательно просто в консольном приложении с++
Каким образом?
bool CALLBACK incomingRPC(stRakNetHookParams *params) {
if (params->packetId == ScriptRPCEnumeration::RPC_ScrGangZoneCreate) {
WORD wGangZoneID;
float minmax[4];
DWORD color;
params->bitStream->ResetReadPointer();
params->bitStream->Read(wGangZoneID);
params->bitStream->Read(minmax);
params->bitStream->Read(color);
SF->getSAMP()->getChat()->AddChatMessage(-1, "GangZoneCreate: %d / %0.2f, %0.2f, %0.2f, %0.2f / %d", wGangZoneID, minmax[0], minmax[1], minmax[2], minmax[3], color);
}
if (params->packetId == ScriptRPCEnumeration::RPC_ScrGangZoneDestroy) {
WORD wGangZoneID;
params->bitStream->ResetReadPointer();
params->bitStream->Read(wGangZoneID);
SF->getSAMP()->getChat()->AddChatMessage(-1, "GangZoneDestroy: %d", wGangZoneID);
}
if (params->packetId == ScriptRPCEnumeration::RPC_ScrGangZoneFlash) {
WORD wGangZoneID;
DWORD color;
params->bitStream->ResetReadPointer();
params->bitStream->Read(wGangZoneID);
params->bitStream->Read(color);
SF->getSAMP()->getChat()->AddChatMessage(-1, "GangZoneFlash: %d / %d", wGangZoneID, color);
}
if (params->packetId == ScriptRPCEnumeration::RPC_ScrGangZoneStopFlash) {
WORD wGangZoneID;
params->bitStream->ResetReadPointer();
params->bitStream->Read(wGangZoneID);
SF->getSAMP()->getChat()->AddChatMessage(-1, "GangZoneStopFlash: %d", wGangZoneID);
}
return true;
}
//Init, Register hook RPC's
SF->getRakNet()->registerRakNetCallback(RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC, incomingRPC);
Кури curlppкак отправлять http запросы? желательно просто в консольном приложении с++
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
void D()
{
int a, b, c, D;
D = pow(b, 2) - 4 * a * c;
return;
}
void D_M()
{
int D;
if (D < 0) cout << "No";
return;
}
void D_B()
{
int D, a, b, c, x1, x2;
if (D > 0)
{
x1 = (-b-sqrt(D)) / (2 * a);
x2 = (-b + sqrt(D)) / (2 * a);
}
return;
}
void main()
{
int a, b, c, x1, x2;
cin >> a >> b >> c;
cout << x1 << endl << x2;
cin.get(); cin.get();
}
Как соединить между собой void ... [Name]? Я знаю, что можно сделать в один void, но нужно в несколько. Не понимаю, как их между собой совместить. Подскажите пооооожалуйста, буду оочень признателен :3
C++:#include <iostream> #include <string> #include <cmath> using namespace std; void D() { int a, b, c, D; D = pow(b, 2) - 4 * a * c; return; } void D_M() { int D; if (D < 0) cout << "No"; return; } void D_B() { int D, a, b, c, x1, x2; if (D > 0) { x1 = (-b-sqrt(D)) / (2 * a); x2 = (-b + sqrt(D)) / (2 * a); } return; } void main() { int a, b, c, x1, x2; cin >> a >> b >> c; cout << x1 << endl << x2; cin.get(); cin.get(); }
#include <iostream>
#include <cmath>
using namespace std;
void func (int a, int b, int c)
{
int D = b * b - 4 * a * c;
if (D > 0)
cout << (float) ( -b + sqrt(D)) / (2 * a) << ' ' << (float) ( -b - sqrt(D)) / (2 * a);
else if (!D)
cout << (float) -b / (2 * a);
else
cout << "No";
}
int main ()
{
int a, b, c;
cin >> a >> b >> c;
func (a, b, c);
return 0;
}
А какая разница, где вводить переменные a b c, в скобках либо внутри void?Твой код (если это можно так назвать) за гранью человеческого понимания 🤪 (Если тебе надо несколько функций, надеюсь, сам как-нибудь справишься *Вздох*)C++:#include <iostream> #include <cmath> using namespace std; void func (int a, int b, int c) { int D = b * b - 4 * a * c; if (D > 0) cout << (float) ( -b + sqrt(D)) / (2 * a) << ' ' << (float) ( -b - sqrt(D)) / (2 * a); else if (!D) cout << (float) -b / (2 * a); else cout << "No"; } int main () { int a, b, c; cin >> a >> b >> c; func (a, b, c); return 0; }
Почитай хотя бы про основы языка , чтобы не задавать такие глупые вопросыА какая разница, где вводить переменные a b c, в скобках либо внутри void?
добавляет и присваивает (+=)Parameters->bitStream->IgnoreBits(1337);
присваивает (=)Parameters->bitStream->SetReadOffset(1337);
а нельзя было просто ошибки написать?При использовании GetOpenFileName появляются две ошибки. Не пойму как решить. Проект https://yadi.sk/d/PDpm7uK5Y-T4KQ (не смог залить на бх из-за размера файла)