Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 4th, 2004, 9:15 PM   #1
kalinga1234
Programmer
 
Join Date: Oct 2004
Posts: 31
Rep Power: 0 kalinga1234 is on a distinguished road
please post some nested loops questions ,becoz i would like to solve it


kalinga B)
kalinga1234 is offline   Reply With Quote
Old Nov 4th, 2004, 9:25 PM   #2
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Write a sorting algorithm with convergence of O(n^2) --a bubble sort-- to sort any randomly generated data set of values with a randomly chosen number of element 1 <= n <= 100.

Have fun (Actually this is not really complex, lol)
__________________
Clifford Matthew Roche &lt;geek@cliffordroche.com&gt;
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Nov 4th, 2004, 10:06 PM   #3
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
I was going to say bubble sort Oh well.

Assuming you know C++:

#include <iostream>
#include <conio.h>

bool cArrEq(char first[], char second[]);
void test(char first[], second[]);

void main(int argc, char* argv[]) {
  char tests[3][32] = { "test", "test", "test2"};
  test(tests[0], test[1]);
  test(tests[0], test[2]);
  test(tests[1], test[2]);
  getch();
}

void test(char first[], char second[]) {
  /*
   * This is a runtime function so that
   * the operations in this function dont
   * have to be repeated numerous times in code...
   * -- no need to edit
   */
  printf("%s == %s\t%d\n", first, second, cArrEq(first, second));
}

bool cArrEq(char first[], char second[]) {
  /*
   * This function should return a true/false
   * value pertaining to if first and second
   * are equal to eachother... this should be 
   * flexible. char arrays should be able to
   * be of different sizes and still work.
   */
}

Just kidding! I knew this was a VB forum -crawls into fetal position in a corner with an embarassed look-
__________________

tempest is offline   Reply With Quote
Old Nov 4th, 2004, 11:15 PM   #4
kalinga1234
Programmer
 
Join Date: Oct 2004
Posts: 31
Rep Power: 0 kalinga1234 is on a distinguished road
hey not fair.. to difficult questions. . post some easy questions ... i am still a beginner to programming you know... Post questions related to visual basic

kalinga1234 is offline   Reply With Quote
Old Nov 4th, 2004, 11:26 PM   #5
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
Alright. Simple challenges... hmmm..

Make code that produces the folling output

1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16
__________________

tempest is offline   Reply With Quote
Old Nov 5th, 2004, 6:22 AM   #6
kalinga1234
Programmer
 
Join Date: Oct 2004
Posts: 31
Rep Power: 0 kalinga1234 is on a distinguished road
too bad I solve the problem.. i need more


kalinga1234 is offline   Reply With Quote
Old Nov 5th, 2004, 6:24 AM   #7
kalinga1234
Programmer
 
Join Date: Oct 2004
Posts: 31
Rep Power: 0 kalinga1234 is on a distinguished road
wait i will post the code..


#include<iostream.h>
int main()
{
int row=0,col=0;

for(row=1;row<5;row++)
{
for(col=1;col<5;col++)
{
cout<<row*col;
}
cout<<"\n";
}
return 0;
}
kalinga1234 is offline   Reply With Quote
Old Nov 5th, 2004, 10:45 AM   #8
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
You said you wanted VB... fine, make an app that asks for a number of lines, and outputs this:

1
2 3 4
5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

And so on, for the number of lines inputted.

Hint: count the number of numbers in each line.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Nov 5th, 2004, 8:09 PM   #9
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Bubble sorts are actually easy stuff, just compare and exchange values... look up how it works on google, since it is a very important algorithm to know anyway
__________________
Clifford Matthew Roche &lt;geek@cliffordroche.com&gt;
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Nov 5th, 2004, 11:20 PM   #10
kalinga1234
Programmer
 
Join Date: Oct 2004
Posts: 31
Rep Power: 0 kalinga1234 is on a distinguished road
your question is too difficult ,,I TRIED but cannot do it... wait i'll post the code...
Private Sub Command1_Click()


For x = 1 To 5 Step 1
For y = x To 1 Step -1
Picture1.Print y;
Next y
Picture1.Print
Next x
End Sub


The question you told cannot be done...please post the code... :wacko:
kalinga1234 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:23 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC