User
Pass
2FA
 
 

C++ AJUTOR!!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message929
Zeyn11

[Mentally Stable]



Status: Offline
(since 24-12-2014 22:37)
Joined: 22 Dec 2014
Posts: 2, Topics: 2
Location: Romania

Reputation: 61.1
Votes: 2

Post Posted: 22-12-2014, 21:14:04 | Translate post to: ... (Click for more languages)

Cum il fac sa se ordoneze crescator elementele unui vector alocat dinamic???? Am inteles ca e cu int *pi=new int[n] ...delete[]pi. Pe mine ma intereseaza pentru N elemente va rog si unde mai trebuie sa modific!!

#include "stdafx.h"
using namespace std;
void main()
{
int i, n;
int *V = new int[100];


delete[]*V;
for (i = 0; i < n; i++){
cout << "V[" << i + 1 << "]= ";
cin >> V[i];
}

for (i = 1; i < n;i++)
if (V[i] < V[i - 1])
if (V[0] == V[n - 1])
cout << "Vectorul este ordonat crescator";
}

0 0
  
Back to top
View user's profile Send private message
'ZeNN

[Account disabled]



Status: Offline
(since 01-02-2016 21:37)
Joined: 15 Nov 2014
Posts: 1955, Topics: 556
Location: Lugoj, Timisoara

Reputation: -38.8
Votes: 462

      dnlonfire 
Post Posted: 22-12-2014, 22:49:25 | Translate post to: ... (Click for more languages)

Salut .
Delete-ul ala nu-ți elibereazã memoria pe care tocmai ai alocato ?
Ca sa faci ordonarea folosește doua for-uri si compari dacã v[i]<v[j],
Asta e parerea mea , imi lasi reply daca e ok sau daca ai alte probleme.


M/
0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  


The time now is 07-02-2025, 09:25:37
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x