Jump to content

Timp rămas până la Black Week

Pentru detalii complete despre promoție click aici

Black Week a început!

Pentru detalii complete despre promoție click aici

Search the Community

Showing results for tags 'cpp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • B-Zone
    • Announcements
    • B-Zone Clips
    • Community
    • Forum Suggestions
    • Market
    • Questions and Answers
  • San Andreas Multiplayer
    • RPG.B-Zone.Ro:7777 Roleplay
    • Wiki Website
  • Rage Multiplayer
    • V.B-ZONE.RO
  • B-Zone Online
    • B-Zone Championships
    • B-Zone Clans & Clubs
    • B-Zone Radios
    • Counter-Strike 1.6
    • Discord
    • Metin2
    • Minecraft
  • IT Zone
    • Design
    • Gadgets
    • Programming
    • Software & Hardware
    • Video Games
  • Real life
    • Entertainment
    • History
    • Juridic
    • Lifestyle
    • Politics
    • Sport
    • Vehicles
  • Trash Can
    • Trash Can
  • The Last Generation [TLG]'s The Last Generation
  • Very Important Person [VIP]'s [VIP] - Topic
  • zero Limits [zL]'s Topics
  • Sons of Anarchy MC [SoA]'s Club Matters
  • Unheard Spirits [END]'s Topics
  • The First Generation [TFG]'s General
  • United Blood Nation [UBN]'s DSICUTII LIBERE MEMBRII!
  • Wild Balkans [WB]'s Informatii
  • True Silent Aimbot [TSA]'s Topics
  • Alliance [A]'s General
  • Merry Weather [MW]'s Prezenta activitati
  • Merry Weather [MW]'s Anunturi Importante
  • Merry Weather [MW]'s Giveaway
  • Merry Weather [MW]'s Giveaway
  • Dangerous Life [dL]'s General
  • Elite Squad [eS]'s Discord
  • Fallen Angels [F]'s Topicurile Clanului # Clan Topics
  • Fallen Angels [F]'s Fallen Angels [F] # Regulament / Rules
  • Fallen Angels [F]'s Fallen Angels [F] # Sistem Promovare / Rank-UP
  • GTT Racing [GTT]'s GTT Racing
  • Hunters [H]'s Regulament
  • The Royal Family [RF]'s The Royal Family [RF]
  • Royal Shadows [RS]'s Rank up % Salarii

Calendars

  • Community Calendar
  • Merry Weather [MW]'s Events

Product Groups

There are no results to display.

Categories

  • MODURI
    • CLEO/SAMPFUNCS
    • Vehicles
    • Skins
    • Sounds
    • Effects
    • Weapons
    • Others
    • Modpacks
  • True Silent Aimbot [TSA]'s Files
  • Merry Weather [MW]'s Event

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Steam ID


Discord


Instagram


Location


Hobbies


Real name


RPG Nickname

Found 1 result

  1. Sortarea a doi vector prin interclasare are ca rezultat un vector sortat crescator, ce contine elementele din ambii vectori. Exemplu: N = 5 A[1] = 1, A[2] = 3, A[3] = 5, A[4] = 7, A[5] = 9 M = 4 B[1] = 2, B[2] = 4, B[3] = 6, B[4] = 8 Rezultatul este vectorul C cu K = N + M = 9 elemente (A[1], B[1], A[2], B[2], A[3], B[3], A[4], B[4], A[5]) Sortarea prin interclasare, varianta clasica O mica explicatie a algoritmului: Se pleaca de la primii doi termeni din cei doi vectori A si B, iar la fiecare pas, alegem mereu elementul cu valoare mai mica, dupa care trecem la urmatorul termen din sirul curent. Daca A < B[j], alegem A si i++; Daca A > B[j], alegem B[j] si j++; #include <iostream> using namespace std; int N, M, A[100], B[100], C[200]; void Read(); void Interclasare(); void Print(); int main() { Read(); Interclasare(); Print(); return 0; } void Read() { cout << "Atentie ! Vectorii A si B trebuie sa fie deja sortati crescator !\n"; cout << "N = ";cin >> N; for(int i = 1; i <= N; ++i) { cout << "A[" << i << "] = ";cin >> A[i]; } cout << "M = ";cin >> M; for(int i = 1; i <= M; ++i) { cout << "B[" << i << "] = ";cin >> B[i]; } } void Interclasare() { int x = 1, y = 1; while(x <= N || y <= M) { if(x <= N && y <= M) { if(A[x] < B[y]) { C[++C[0]] = A[x]; ++x; } else { C[++C[0]] = B[y]; ++y; } } else { if(x <= N) { C[++C[0]] = A[x]; ++x; } else { C[++C[0]] = B[y]; ++y; } } } } void Print() { cout << "C: "; for(int i = 1; i <= C[0]; ++i) { cout << C[i] << ' '; } cout << '\n'; } Pentru intrebari, sugestii, neclaritati, lasati un reply in acest topic.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.