|
Massiv tushunchasi
|
bet | 3/3 | Sana | 18.12.2023 | Hajmi | 22,07 Kb. | | #122710 |
Bog'liq Массив{ cout<<" a["<> a[i];
}
cout<<"\n ********************** \n";
cout<<"\n";
for (int i=0; i<5; i++)
{ c[i] = a[2*i +1];
b[i] = a[2*i];
cout << " b["<<2*i<<"]=\a" << b[i];
cout << " \t c["<<2*i+1<< "]=\a" << c[i] <
getch ( );
}
4-misol. A va V massivlari berilgan. Yangi S massivini quyidagicha hosil qiling: A massivining elementlari yangi massivning juft indekslari,
V massivining elementlari esa yangi massivning toq indekslarini tashkil etsin.
# include
# include
using namespace std;
int main ( )
{ float a[5], b[5], c[10]; int i;
for ( i=0; i<5; i++)
{ cout<<" a["<> a[i];
cout<<" b["<> b[i]; }
for ( i=0; i< 5; i++)
{ c[2*i+1] = b[i];
c[2*i] = a[i]; }
cout<<"\n";
for (i = 0; i < 10; i++)
cout << " c[" << i << "]= " << c[i] <
getch ( );
}
|
| |