Berikut ini pertanyaan dari eurica atushi disini.
hi there i have a question here..
write a program that reverses the string contents of a stack (the top and bottom elements exchange positions, the second last element exchange positions, and so forth until the entire stack is reversed). Hint: you may use a second stack. The following diagram illustrates the exchange process.
A E
B D
C C
D B
E A
Ah, dasar saya nggak terlalu ngerti english, jadi mesti baca baik-baik dulu maksud pertanyaannya. Dan setelah mencoba mengerti, kurang lebih maksudnya adalah bagaimana logika membalik isi sebuah array. Saya sudah mencoba membuat programnya, kalau ada yang berminat download, silahkan klik disini.
25 Comment
thanx ya…
i have another question that i really2 confuse… can u help me… pls
Assume that you are required to enter a list of strings into a computer, rearrange them
in alphabetical order, and then print out the rearranged list. The strings must be stored
in a two-dimensional character array. Each string will be stored in a separate row
within the array. You may use any suitable string manipulation functions. One of the
library functions that can be used is strcmpi.
strcmpi compares the strings but does not differentiates between upper and
lowercase characters. The function accepts two strings as arguments and returns
integer value, depending on the relative order of the two strings, as follows:
a) A negative value is returned if the first string alphabetically precedes the second
string.
b) A value of zero is returned if the first string and the second string are identical.
c) A positive value is returned if the second string alphabetically precedes the first
string.
If the function strcmpi (string1, string2) returns a positive value then, this
indicates that string2 must be placed ahead of string1 in order to rearrange the
two strings in alphabetical order.
Sample output is given as follows:
Enter each string on a different line:
Type ‘END’ when finished
String 1: Panda
String 2: Apple
String 3: Island
String 4: Calendar
String 5: Brown
String 6: Black
String 7: Rainbow
String 8: News
String 9: Ballroom
String 10: Canada
String 11: END
Reordered list of strings:
String 1: Apple
String 2: Ballroom
String 3: Black
String 4: Brown
String 5: Calendar
String 6: Canada
String 7: Island
String 8: News
String 9: Panda
String 10: Rainbow
String 11: END
this question its make me confuse
Assume that you are required to enter a list of strings into a computer, rearrange them
in alphabetical order, and then print out the rearranged list. The strings must be stored
in a two-dimensional character array. Each string will be stored in a separate row
within the array. You may use any suitable string manipulation functions. One of the
library functions that can be used is strcmpi.
strcmpi compares the strings but does not differentiates between upper and
lowercase characters. The function accepts two strings as arguments and returns
integer value, depending on the relative order of the two strings, as follows:
a) A negative value is returned if the first string alphabetically precedes the second
string.
b) A value of zero is returned if the first string and the second string are identical.
c) A positive value is returned if the second string alphabetically precedes the first
string.
If the function strcmpi (string1, string2) returns a positive value then, this
indicates that string2 must be placed ahead of string1 in order to rearrange the
two strings in alphabetical order.
Sample output is given as follows:
Enter each string on a different line:
Type ‘END’ when finished
String 1: Panda
String 2: Apple
String 3: Island
String 4: Calendar
String 5: Brown
String 6: Black
String 7: Rainbow
String 8: News
String 9: Ballroom
String 10: Canada
String 11: END
Reordered list of strings:
String 1: Apple
String 2: Ballroom
String 3: Black
String 4: Brown
String 5: Calendar
String 6: Canada
String 7: Island
String 8: News
String 9: Panda
String 10: Rainbow
String 11: END
iii..? engken ne..?
wkwkw.. sorting algorithm though!
waduh kebetulan nih.. ak lagi belajar C++ untuk nantinya bekal belajar PHP. katanya sih hampir sama…..
Mungkin yg dimaksud adalah urutan Accending n Decendingnya….
#eurica atushi
you are welcome..
give me a moment
#paramarta
engken kaden, saya juga bingung
#imsuryawan
hahahaha…
#Uyax
yuk belajar bareng
Memang sama
pak…
saya pusing,inguh,stress sama buku tebal bermerk c++…
saya jadi tambah pusing saja…
bagaimana cara belajar yang efektif????
sorry
ini url kakak saya
thank’s
#surya
sebelum belajar buku C++ yang tebal itu, ada baiknya belajar algoritma dulu. Setelah itu, baru terapkan dengan belajar C++. Semua skrip contoh program di buku itu dicoba saja langsung, jadi akan lebih mengerti.
thank you boss…
berarti saya harus mencari materi tentang algoritma itu??
oooo iya,,kemarin saya sempat mencarinya di in
ternet..apakah itu cukup pak??
atau saya mesti mencari buku paduan yang lainnya??
#kuta beach bali
Internet atau buku boleh2 saja. Bedanya kalau di internet gratis,tetapi kita harus bisa memilih dan mempelajari sesuai dengan level ilmu kita. Sedangkan dari buku biasanya lebih enak belajarnya, tetapi mungkin ya harus beli bukunya, kecuali ada perpustakaan yang lengkap untuk buku IT/Pemrograman.
Ada satu cara lagi yaitu : kuliah.
oya pak…ok..ok..
tapi tadi waktu praktek banyak program-program yang salah di buku c++…
trus saya harus kuliah dimana??
link ini punya kakak saya,,!!!
maav sebelumnya..
uh…. *pulang kampung tidur di panggung*
#kuta beach bali
alah, kok pake minta maaf segala..
di buku itu memang ada beberapa yg salah ketik.
kuliah jurusan informatika, di bali ada banyak kampus jurusan itu.
#almascatie

pak dosen, gimana caranya nampilin A++?

tiang sing nyak maan C++ soale.
#anton
gampang pak, tinggal hapus C-nya trus ganti dengan A
nie paan yaw
kagak ngerti saia
Saya juga nggak ngerti, hihihi
so what do you think about my question… does anyone have the answer?
Now you find the answer here. I’m sorry because maybe the answer is too late.
[…] Berikut ini satu pertanyaan lagi yang ditanyakan oleh eurica atush disini. […]
pak saya mau nanya!
gmn cara membalik inputan karakter seperti :
masukkan nama : Erik
reverse : kirE
tolong dibantu menggunakan perintah apa dlm c++, kalo bisa sekalian dibuatin programnya
terima kasih
saya sudah pernah coba membuatnya, silahkan lihat disini.
wah…assalamu’alaikum. salam kenal!
aku mau ikutan juga dong nimba ilmu mas wira…
aku gabung ya…
tapi saat ini aku blom ada pertanyaan…
terimakasih…
wass
silahkan, dengan senang hati, yuk sama-sama belajar
mas_wira.aku lagi ngebet banget belajar cpp.aku mohon bantuannya ya nanti…
terima kasih mas…
sama-sama, hehe. Belum apa-apa udah teima kasih, jadi ga enak saya
Haloo Pak…..
Pak saya mau tanya…
Saya punya proggram Stack sbb :
//Program Tumpukan/ Stack
#include
#include
//Deklarasi stack dengan struct dan array
struct STACK
{
int data[5];
int atas;
};
//Deklarasi variabel ‘tumpuk’ dari struct
STACK tumpuk;
void main()
{
clrscr();
int pilihan,baru,i;
//Inisialisasi awal
tumpuk.atas=-1;
do
{
clrscr();
cout<<”1. Push Data( masukan data )”<<endl;
cout<<”2. Pop Data( hapus data )”<<endl;
cout<<”3. Print Data”<<endl;
cout<<endl;
coutpilihan;
clrscr();
switch(pilihan)
{
case 1:
{
if(tumpuk.atas==5-1)
{
cout<<”Tumpukan penuh”;
getch();
}
else
{
coutbaru;
tumpuk.atas++;
tumpuk.data[tumpuk.atas]=baru;
}
break;
}
case 2:
{
if(tumpuk.atas==-1)
{
cout<<”Tumpukan kosong”;
getch();
}
else
{
cout<<”Data yang akan di Pop = “<<tumpuk.data[tumpuk.atas];
tumpuk.atas–;
getch();
}
break;
}
case 3:
{
if(tumpuk.atas==-1)
{
cout<<”Tumpukan kosong”;
getch();
}
else
{
cout<<”Data = “;
for(i=0;i<=tumpuk.atas;i++)
{
cout<<tumpuk.data[i]<<” “;
}
getch();
}
break;
}
default:
{
clrscr();
cout<<”Tidak ada dalam pilihan”<=1 && pilihan<=3);
getch();
}
Yang ingin saya tanyakan, kenapa nilai pada (inisialiasasi awal) tumpuk.atas = -1 ?
Apa nilai tersebut baku?
Kalau bisa saya mau minta program stack dari Bapak agar bisa menjadi pembanding…
Sebelumnya saya ucapkan terima kasih…
Sepertinya tidak baku, kalau dirubah, berarti nilai variabel yg lain juga dirubah. Tapi contoh diatas ini banyak yg error. Kalau mau, coba kirim file code-nya ke email saya.
Knpa tumpukan awal selalu -1 ? Karena indeks array itu dimulai dari 0 bukan dari 1,misalkan ada sebuah array mempunya 5 elemn maka indeksnya 0 1 2 3 4 jadi sewaktu kita membuat program stack tumpukan_awal dari -1 yang menandai stack tesebut masih kosong. Ncepz
terima kasih tanggapannya
Leave a Reply