Inomjonov Jakhongir 120-20
Berilgan sozgacha bolgan sozlarni o’chiradigan dastur tuzing
#include
#include
using namespace std;
int main()
{
cout << strstr( "Tatu 120-20 guruh talabasi","guruh" );
return 0;
}
Satrdagi so’zlarni teskarisiga almashtiradigan dastur tuzing
#include
#include
using namespace std;
string reverse_char(char str[]){
string rever;
int j=0;
for (int i = strlen(str)-1; i>=0 ; --i) {
rever+=str[i];
}
return rever;
}
int main(){
char a[]="print hello world";
cout<
return 0;
}
String turidagi Satr berilgan. Undagi elementlarni char turidagi A massivga alfavit boʻyicha, byte turidagi B massivga oʻsish tartibida joylashtiruvchi dastur tuzing.
#include
#include
using namespace std;
char* sarala_osish(char *a,int n){
for (int i = 0; i
char t;
for (int j = i+1; j < n; ++j) {
if (a[i]>a[j]){
t=a[j];
a[j]=a[i];
a[i]=t;
}
}
}
return a;
}
char* sarala_kamayish(char *a,int n){
for (int i = 0; i
char t;
for (int j = i+1; j < n; ++j) {
if (a[i]
t=a[j];
a[j]=a[i];
a[i]=t;
}
}
}
return a;
}
int main(){
string s="Jakhongir";
char const *A = s.c_str();
char const *B = A;
cout<
B=sarala_kamayish((char *) B, s.length());
cout<
return 0;
}
Do'stlaringiz bilan baham: |