Лабораторная работа№2 Проектирование алгоритмов Группа: 962-20 (заочная) Сдал(а): Оллоёров Тохир Принял: 1-Topshiriq
Download 0.84 Mb.
|
1 2
Bog'liqOlloyarov Tohir lab2
МИНИСТЕРСТВО РАЗВИТИЯ ИНФОРМАЦИОННЫХ ТЕХНОЛОГИЙ И РАЗВИТИЯ КОММУНИКАЦИИ РЕСПУБЛИКИ УЗБЕКИСТАНУРГЕНЧЕСКИЙ ФИЛИАЛ ТАШКЕНТСКОГО УНИВЕРСИТЕТА ИНФОРМАЦИОННЫХ ТЕХНОЛОГИЙ ИМЕНИ МУХАММАДА АЛЬ-ХОРАЗМИЙЛабораторная работа№2 Проектирование алгоритмов Группа: 962-20 (заочная) Сдал(а): Оллоёров Тохир Принял: 1-Topshiriq
#include using namespace std; double func(int a[], int b[], int n) { for (int i = n-1; i >= 1; i--) for (int j = 0; j < i; j++) { if (a[j] > a[j+1]) { swap(a[j],a[j+1]); swap(b[j],b[j+1]); } if(a[j]==a[j+1] and b[j+1]==0) swap(b[j],b[j+1]); } } int main() { int n; cin>>n; int a[n],b[n]; for(int i=0; i cin>>a[i]; if(a[i]<0) { b[i]=0; a[i]*=-1; } else b[i]=1; } func(a,b,n); cout<<"\nNatija...\n"; for(int i=0; i if(b[i]==0) a[i]*=-1; } for(int i=0; i cout<} } 5-Topshiriq On programming contests each team consists of three people and has a name. Write a program that for a team name and surnames of the participants, the full name of the team builds. Full name of the team consists of a short list of team names and the names of its members. Names of the participants in the list must be sorted alphabetically and separated by exactly one comma and space and must be brackets on both side(see examples). Input The Input contains exactly 4 lines. The first line contains the name of team. Each of the following three lines contains the surname of one of the teammates. The Lengths of the lines do not exceed 50 symbols. Download 0.84 Mb. Do'stlaringiz bilan baham: |
1 2
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling