Sei sulla pagina 1di 5

#include <iostream>

#include <cstdlib>

using namespace std;

int main ()

int n=10 ;

int legit = n ;

int majtas=0 ;

int djathtas = 1 ;

int vektor [n];

int i ;

cout <<"jepni nje liste me 10 nr te plote"<<endl ;

for (i=0; i<n ; i++)

cin>>vektor[i];

while (majtas< legit){

if(vektor[majtas]!=0){

majtas++ ;

djathtas ++ ; }

else

legit-- ;

while ( djathtas<n){

vektor[djathtas-1]*vektor[djathtas];

djathtas*djathtas+1 ; }

djathtas*majtas+1 ; }
}

cout <<"lista e re pas aplikimit te alg zhvendos-majtas \n" ;

for (i=0 ; i<n ; i++)

cout <<vektor[i]<<" " ;

cin.get () ;

return 0 ;

------------------------------------------------------------------------------------------------------------------------------------------
----------------------ushtrimi 2---------------------------------------------copy over---------------------------------------------

#include <iostream>

#include <cstdlib>

using namespace std;

int main ()

int n=10 ;

int new_pos=0 ;

int majtas =0 ;

int vektor [n];

int i ;

cout <<"jepni nje liste me 10 nr te plote"<<endl ;

for (i=0; i<n ; i++)


cin>>vektor[i];

while (majtas < n){

if (vektor[majtas]!=0){

vektor[new_pos]=vektor[majtas];

majtas++ ;

new_pos++ ;

else

majtas=majtas +1 ; }

cout<<"lista e re pas aplikimit te alg copy over \n" ;

cout <<"new_pos :="<<new_pos <<endl ;

for (i=0 ; i<new_pos ; i++)

cout<<vektor [i]<< " " ;

cin.get () ;

cin.get () ;

return 0 ;
}

--------------------------------------------ushtrimi nr 3-----------------------------------------------------------------------------
-------------------------------------------------------------------shenjuesit konvergjent-----------------------------------------

#include <iostream>

#include <cstdlib>

using namespace std;

int main ()

int n=10 ;

int legit =n ;

int majtas =0 ;

int djathtas = n-1 ;

int vektor[n] ;

int i ;

cout <<"jepni nje liste me 10 numra te plote "<<endl ;

for (i=0 ; i<n; i++)

cin>>vektor[i];

while (majtas < djathtas) {

if (vektor[majtas]!=0) {

majtas++ ;

else
{

legit-- ;

vektor [majtas]=vektor[djathtas];

djathtas--;

if (vektor[majtas]==0)

legit-- ;

cout<<"lista e re pas aplikimit te alg te shenjuesave konvergjent \n" ;

for (i=0 ; i<legit; i++)

cout<<vektor[i]<< " " ;

cin.get () ;

cin.get () ;

return 0 ;

------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------ --------------------------------------------------------------------------