cReTzUUUU Posted June 29, 2020 Posted June 29, 2020 //se citesc datele intr un vector . Sa se tipareasca sortat vectorul... #include <iostream> using namespace std; void citesc(int vt[10], int n) { int i; for(i=1; i<=n; i++) {cout<<"v["<<i<<"]= "; cin>>vt[i];} } void sortez(int vt[10], int n) { int i,gasit,aux; do { gasit=0; for(i=1; i<=n-1; i++) if (vt[i]>vt[i+1]) { aux=vt[i];vt[i]=vt[i+1];vt[i+1]=aux; gasit=1; } }while(gasit); // {cout<<"v["<<i<<"]= "; cin>>vt[i];} } void scriu(int vt[10], int n) { int i; for(i=1; i<=n; i++) cout<<vt[i]<<endl; } int main(void) { int n, v[30]; cout<<"Dati dimensiunile vectorului \n"; cout<<"n = ";cin>>n; citesc (v,n); sortez(v,n); scriu(v,n); } 2
Administrators th3#afk Posted August 1, 2020 Administrators Posted August 1, 2020 aceasta e anulata nu trebuie neaparat sa o scrii : // {cout<<"v["<<i<<"]= "; cin>>vt[i];} 2 Blog personal : https://www.facebook.com/jurnalulunuivisator/ Canal youtube : https://www.youtube.com/gabytzuspecial Grup muzica : https://www.facebook.com/groups/muzica2025
Scripter aEEk.# Posted January 18, 2021 Scripter Posted January 18, 2021 are un nume algoritmul de sortare sau nu? 1 sizeof(Life) - 1 Segmentation fault (core dumped)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now