Ismoilova Shohidaning dasturlash 2 fanidan 3-topshiriq javobi. Tekshirdi: Xaydarova Marhamat


Download 1.17 Mb.
Sana16.06.2023
Hajmi1.17 Mb.
#1499579

Al Xorazmiy nomidagi Toshkent Axborot texnologiyalari univarsitetining dasturiy injiniring fakulteti 1-kurs talabasi Ismoilova Shohidaning dasturlash 2 fanidan 3-topshiriq javobi.



Tekshirdi: Xaydarova Marhamat.


#include
#include
using namespace std;
int main() {
stack st, nw;
int n,min=0;
cout<<"N = ";
cin>>n;
for(int i=0; iint temp;
cin>>temp;
if(i == 0 || temp < min) min = temp;
st.push(temp);
}
while(!st.empty()) {
if( (st.top() == min) )
nw.push(0);
nw.push(st.top());
st.pop();
}
while(!nw.empty()) {
cout<nw.pop();
}
return 0;
}





#include
#include
#include
#include
#include
using namespace std;
#define EBB cout<<"==========================================================\n"
class football
{
public:
string ism, fam, sh;
long long daromadi;
double yoshi;
};
class tens : public football
{
public:
double lengtha;
tens (string ism, string fam, string sh, long long daromadi, double yoshi, double lengtha){
this->ism=ism;
this->fam=fam;
this->sh=sh;
this->daromadi=daromadi;
this->yoshi=yoshi;
this->lengtha=lengtha;
}
void getten()
{
cout<cout<<"daromadi-> "< "< "<EBB;
}
};
bool lengths (tens &E, tens &B)
{
return (E.lengtha > B.lengtha);
}
int main ()
{
int n;
cout<<" Tenschilar necha kishi -> ";
cin>>n;
string is,f,s;
long long d;
double y,b;
vector< tens > ebb;
for (int i = 0; i < n; i++)
{
cout< "; cin>>is;
cout< "; cin>>f;
cout< "; cin>>s;
cout< "; cin>>d;
cout< "; cin>>y;
cout< "; cin>>b;
ebb.push_back( tens (is,f,s,d,y,b));
}
EBB;
sort(ebb.begin(), ebb.end(),lengths);
vector::iterator ee;
for ( ee = ebb.begin(); ee != ebb.end(); ++ee)
{
tens b= *ee;
b.getten();
}
system("pause");
}

Download 1.17 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling