mfar 0 Report post Posted August 12, 2005 (edited) Berkenaan soalan² cadeSoalan 1: [EDIT] dah betulkan error dah, tapi masalahnya out put yg kita nak tu, xder, hanya kuar arahan mintak input user saja.... jadi ntah mana lagi yg tak betulnya Soalan 2:{ for (int x=1;x<6;x++){ for (int y=1;y<=x;y++) cout<<y; cout<<endl;}pendekkan lagi { for (int x=0;x<5;x++) for (int y=1;y<[x+1];y++) cout<<y<<endl;}::kurang satu baris saja :: Edited August 15, 2005 by mfar Quote Share this post Link to post Share on other sites
Vibrunnica 0 Report post Posted August 13, 2005 (edited) wohhh..sampai ke pagi wat assignment..... soklan no 1c camner ek... ??? Pening aaaa.. bagi tip sket...baru blajar sampai "if" statement.... dia ada guna function lain ke..? atau aku ni lembab sangat...aaahhh tiu laa.... BTW..ni jwp yg aku dah buat...No 1a : { for (int x=1;x<6;x++){ for (int y=1;y<=x;y++) cout<<"$"; cout<<endl; } No 1b : { for (char x='F';x>='A';x--){ for (char y='F'; y>=x; y--) cout<<y; cout<<endl; } No 1d : { for (int x=1;x<=6;x++){ for (int y=6;y>=x;y--) cout<<"*"; cout<<endl; } hmmmm......Soklan no 2 dalam proses...sangkut kat soklan no 1c puaka tu...heeheheheHmmmm....gila babeng tul...donlod tutorial.... ingat sket jek...bila dah siap print...tu dia...tebal gila....heheheheheh..... Edited August 13, 2005 by Vibrunnica Quote Share this post Link to post Share on other sites
mfar 0 Report post Posted August 15, 2005 wohhh..sampai ke pagi wat assignment..... soklan no 1c camner ek... ??? nih ha, aku kasi coding ala budak freshie.... baru buat smalam #include <iostream.h> #include <conio.h> void main() { char h[5]="ABCDE"; int x,y1,y2,z; for(x=0;x<5;x++){ for(z=4;z>x;z--) cout<<" "; for(y1=0;y1<x;y1++) cout<<h[y1]; for(y2=x;y2>=0;y2--) cout<<h[y2]; cout<<endl;} getch();}Mati² nak buat gelung dalam gelung dalam gelung last² gelung banyak² dlm satu gelung besar jer Sendiri punya dah dapat ke? Quote Share this post Link to post Share on other sites
encik pot pet 0 Report post Posted August 15, 2005 ok la... code mfar tak ikut standard.. so aku just repair la sket tambah indentation #include <iostream> using namespace std; int main() { char h[]="ABCDE"; int x, y1, y2, z; for(x=0; x<5; x++) { for(z=4; z>x; z--) cout<<" "; for(y1 = 0; y1< x; y1++) cout<<h[y1]; for(y2 = x; y2 >= 0; y2--) cout<<h[y2]; cout<<endl; } return 0; } Quote Share this post Link to post Share on other sites
mfar 0 Report post Posted August 16, 2005 ok la... code mfar tak ikut standard.. so aku just repair la sket tambah indentationMmglah tak ikut standard MSVC (Ms Visual C++) sbb aku pakai Borland C++.. tapi, it's ok for MSVC users for adding apa yg kurang bg coding versi Borland tu... Quote Share this post Link to post Share on other sites
Ancient One 3 Report post Posted August 17, 2005 actually zeph bukan bermaksud nak cakap tak ikut std MSVC... Quote Share this post Link to post Share on other sites