![]() |
please post some nested loops questions ,becoz i would like to solve it
kalinga B) |
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 :P (Actually this is not really complex, lol) |
I was going to say bubble sort :( Oh well.
Assuming you know C++: :
#include <iostream>Just kidding! I knew this was a VB forum -crawls into fetal position in a corner with an embarassed look- |
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
:P |
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 |
too bad I solve the problem.. i need more
:P |
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; } |
You said you wanted VB... fine, make an app that asks for a number of lines, and outputs this:
:
1And so on, for the number of lines inputted. Hint: count the number of numbers in each line. |
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 ;)
|
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: |
| All times are GMT -5. The time now is 8:01 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC