اذهب إلى المحتوى

حورية القطيطية

الأعضاء
  • المساهمات

    4
  • تاريخ الانضمام

  • تاريخ آخر زيارة

آخر الزوار

لوحة آخر الزوار معطلة ولن تظهر للأعضاء

إنجازات حورية القطيطية

عضو مبتدئ

عضو مبتدئ (1/3)

2

السمعة بالموقع

  1. class Main{ static void reverse(String s) { Stack stc = new Stack<>(); String temp = ""; for(int i = 0; i < s.length(); i++) { if(s.charAt(i) == ' ') { stc.add(temp); temp = ""; } else { temp = temp + s.charAt(i); } } stc.add(temp); while(!stc.isEmpty()) { temp = stc.peek(); System.out.print(temp + " "); stc.pop(); } System.out.println(); } public static void main(String[] args) { String s = ""; reverse(s); } } من فضلك هكذا،؟؟
  2. Get the string as input from the user Split the string into characters Push these characters into a stack one by one until the string is finished Pop from stack one by one and put it in another character array/string Display the contents of the new character array/string
  3. Write a program that reverses a string using a stack. The following pseudocode will help you in implementing the task , code standards: 😎 Get the string as input from the user Split the string into characters Push these characters into a stack one by one until the string is finished Pop from stack one by one and put it in another character array/string Display the contents of the new character array/string
×
×
  • أضف...