Tajriba ishi 9
Download 216.5 Kb.
|
Tajriba ishi 9 0 Paradigmalar Xusinov Shaxriyor
Dastur natijasi n=8
kirit=1 kirit=2 kirit=3 kirit=4 kirit=5 kirit=6 kirit=7 kirit=8 dek ele-tlari=4 3 2 1 5 6 7 8 dek ele-tlari=4 8 2 6 TopshiriqVariantlar: Kiritilgan ismning harflarini alfavit bo”yicha tartibga keltiring. package Lab9; import java.util.Arrays; public class first { public static void main(String[] args) { String inputString = "Shaxriyor"; String outputString = sortString(inputString); System.out.println("Input String : " + inputString); System.out.println("Output String : " + outputString); } // Alfabit bo'yicha saralaydigan sortString funksiyasi public static String sortString(String inputString) { char tempArray[] = inputString.toCharArray(); Arrays.sort(tempArray); return new String(tempArray); } } Stekning eng kata elementini toping. #include #include using namespace std; void findMax(stack { int m = s.top(); int a; while (!s.empty()) { a = s.top(); if (m < a) m = a; s.pop(); } cout << "\n\n Stackning maxsimal elementi: " << m << endl; } void show(stack { while (!s.empty()) { cout << " " << s.top(); s.pop(); } cout << endl; } int main() { int i; stack s.push(4); s.push(2); s.push(20); s.push(12); s.push(52); s.push(14); show(s);
return 0; } Download 216.5 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling