India Broadband Forum


programming challenge...

This is a discussion on programming challenge... within the Entertainment and Recreation forums, part of the General offtopic discussions category; I think I need to sleep. My program had change & giving me this: p p p p p p ...

Go Back   India Broadband Forum > General > General offtopic discussions > Entertainment and Recreation

India Broadband Forum


Entertainment and Recreation Everything related to entertainment like movies, jokes and other funny stuff goes here

                      

Reply

 

LinkBack Thread Tools Display Modes
Old 08-06-09, 01:49 AM   #41
Jedi knight
 
Luke Skywalker's Avatar
 
Join Date: Jul 2009
Location: IBF
Age: 21
Posts: 1,818
Rep Power: 5
Luke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the rough
Default

I think I need to sleep.
My program had change & giving me this:
p p p p
p p p p
p p p p
p p p p
Luke Skywalker is offline   Reply With Quote
Old 08-06-09, 01:50 AM   #42
Platinum Member
 
Join Date: Sep 2008
Posts: 3,140
Rep Power: 10
Punch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to all
Default

Quote:
Originally Posted by nandini View Post
Alrighto!!!

I'll give it a try tomorrow. I am so tired that I can't concentrate.
can you dilute?

Quote:
Originally Posted by Luke View Post
I think I need to sleep.
My program had change & giving me this:
p p p p
p p p p
p p p p
p p p p
you have P'd a lot ;-)

-F

Last edited by Punch Farce; 08-06-09 at 01:50 AM. Reason: Automerged Doublepost
Punch Farce is offline   Reply With Quote
Old 08-06-09, 01:52 AM   #43
Pri_dm
Guest
 
Posts: n/a
Default

i = -1;
n = 0;
j = 0;
k = 0;
l = 0;
while (n <17)
{
if (i < 3)
{
i++;
k = 0;
}
else
{
l++;
k = l;
}
for (j = 0; j<= i-l; j++)
{
char2DArray[i-j][k]=charArray[n];
n++;
k++;
}
}
  Reply With Quote
Old 08-06-09, 01:55 AM   #44
Platinum Member
 
Join Date: Sep 2008
Posts: 3,140
Rep Power: 10
Punch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to all
Default

more complexion coming up.
version 2.0 with more features and flexibility ;-)

> a.out 0




> a.out 1
a



> a.out 2
ac
bd


> a.out 3
acf
beh
dgi

> a.out 4
acfj
beim
dhlo
gknp
>

Quote:
Originally Posted by Pri_dm View Post
i = -1;
n = 0;
j = 0;
k = 0;
l = 0;
while (n <17)
{
if (i < 3)
{
i++;
k = 0;
}
else
{
l++;
k = l;
}
for (j = 0; j<= i-l; j++)
{
char2DArray[i-j][k]=charArray[n];
n++;
k++;
}
}

does this work? plese post output. (please don't post source until later)

thanks
-f

Last edited by Punch Farce; 08-06-09 at 01:55 AM. Reason: Automerged Doublepost
Punch Farce is offline   Reply With Quote
Old 08-06-09, 01:57 AM   #45
newprouser
Guest
 
Posts: n/a
Default

are you guys discussing a different program, i jus got the answer for the first one ...

should i post it now ??
  Reply With Quote
Old 08-06-09, 01:58 AM   #46
Platinum Member
 
Join Date: Sep 2008
Posts: 3,140
Rep Power: 10
Punch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to all
Default

Quote:
Originally Posted by newprouser View Post
are you guys discussing a different program, i jus got the answer for the first one ...

should i post it now ??
it is difficult to tell from pri's code ;-) but it is the first one.

yes please, just the results, let's give Luke some time till we
post the code.

-F
Punch Farce is offline   Reply With Quote
Old 08-06-09, 02:01 AM   #47
Pri_dm
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by farce View Post



does this work? plese post output. (please don't post source until later)

thanks
-f
yes it worked on dry run

i = -1;
n = 0;
j = 0;
k = 0;
l = 0;

while (n <17)
{
if (i < 3)
i++;
else
l++;

k = 0;
for (j = 0; j<= i-l; j++)
{
char2DArray[i-j][k]=charArray[n];
n++;
k++;
}
}

Try this farce ;-)

Last edited by Pri_dm; 08-06-09 at 02:01 AM. Reason: Automerged Doublepost
  Reply With Quote
Old 08-06-09, 02:01 AM   #48
newprouser
Guest
 
Posts: n/a
Default

output.JPG
  Reply With Quote
Old 08-06-09, 02:01 AM   #49
Jedi knight
 
Luke Skywalker's Avatar
 
Join Date: Jul 2009
Location: IBF
Age: 21
Posts: 1,818
Rep Power: 5
Luke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the rough
Default

class Math
{
public static void main(String[] args)
{

char[] charArray={'a','b','c','d','e','f','g','h','i','j' ,'k','l','m','n','o','p'};
char[][] char2DArray=new char[4][4];
char[][] a=new char[4][4];


for(int x=0; x<charArray.length; x++){
for(int d=0; d<char2DArray.length; d++){
for(int b=0; b<char2DArray[d].length; b++){


char2DArray[b][d] = (char)charArray[x];


}}}
for(int i = 0; i <= 3; i++) {
System.out.print("");
for(int j = 0; j <= 3; j++) {
System.out.print(" " + char2DArray[i][j]);
}
System.out.println("");
}
System.out.println();
}
}

What the hell had happened that this is not copying?
@Farce can I pm you my poetry again?
Luke Skywalker is offline   Reply With Quote
Old 08-06-09, 02:03 AM   #50
Pri_dm
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Luke View Post
@Farce can I pm you my poetry again?
even i wanna read ur poetry
  Reply With Quote
Old 08-06-09, 02:05 AM   #51
Jedi knight
 
Luke Skywalker's Avatar
 
Join Date: Jul 2009
Location: IBF
Age: 21
Posts: 1,818
Rep Power: 5
Luke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the rough
Default

Quote:
Originally Posted by Pri_dm View Post
yes it worked on dry run

i = -1;
n = 0;
j = 0;
k = 0;
l = 0;

while (n <17)
{
if (i < 3)
i++;
else
l++;

k = 0;
for (j = 0; j<= i-l; j++)
{
char2DArray[i-j][k]=charArray[n];
n++;
k++;
}
}

Try this farce ;-)
Who was your teacher?
This is good but can't understand head or tail of it in one go.

Quote:
Originally Posted by Pri_dm View Post
even i wanna read ur poetry
No you don't. It is for advice. I will give you final version before other.

will come to see response 7 min later.

Last edited by Luke Skywalker; 08-06-09 at 02:05 AM. Reason: Automerged Doublepost
Luke Skywalker is offline   Reply With Quote
Old 08-06-09, 02:07 AM   #52
Platinum Member
 
Join Date: Sep 2008
Posts: 3,140
Rep Power: 10
Punch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to all
Default

Quote:
Originally Posted by Luke View Post
class Math
{
public static void main(String[] args)
{

char[] charArray={'a','b','c','d','e','f','g','h','i','j' ,'k','l','m','n','o','p'};
char[][] char2DArray=new char[4][4];
char[][] a=new char[4][4];


for(int x=0; x<charArray.length; x++){
for(int d=0; d<char2DArray.length; d++){
for(int b=0; b<char2DArray[d].length; b++){


char2DArray[b][d] = (char)charArray[x];


}}}
for(int i = 0; i <= 3; i++) {
System.out.print("");
for(int j = 0; j <= 3; j++) {
System.out.print(" " + char2DArray[i][j]);
}
System.out.println("");
}
System.out.println();
}
}

What the hell had happened that this is not copying?
@Farce can I pm you my poetry again?
you want me to debug your program?

sure, PM me.

-F
Punch Farce is offline   Reply With Quote
Old 08-06-09, 02:12 AM   #53
Jedi knight
 
Luke Skywalker's Avatar
 
Join Date: Jul 2009
Location: IBF
Age: 21
Posts: 1,818
Rep Power: 5
Luke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the rough
Default

Now I am using C++. So that farce can help me.

Quote:
Originally Posted by farce View Post
you want me to debug your program?

sure, PM me.

-F
Of course tell me why array is not copying.

Last edited by Luke Skywalker; 08-06-09 at 02:12 AM. Reason: Automerged Doublepost
Luke Skywalker is offline   Reply With Quote
Old 08-06-09, 02:13 AM   #54
Platinum Member
 
Join Date: Sep 2008
Posts: 3,140
Rep Power: 10
Punch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to all
Default

Quote:
Originally Posted by Pri_dm View Post
yes it worked on dry run

i = -1;
n = 0;
j = 0;
k = 0;
l = 0;

while (n <17)
{
if (i < 3)
i++;
else
l++;

k = 0;
for (j = 0; j<= i-l; j++)
{
char2DArray[i-j][k]=charArray[n];
n++;
k++;
}
}

Try this farce ;-)
"pri.c" 35 lines, 432 characters
> !cc
cc pri.c
> a.out


Segmentation Fault (core dumped)
>

Punch Farce is offline   Reply With Quote
Old 08-06-09, 02:14 AM   #55
Jedi knight
 
Luke Skywalker's Avatar
 
Join Date: Jul 2009
Location: IBF
Age: 21
Posts: 1,818
Rep Power: 5
Luke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the rough
Default

I am using C++ . Farce if you can tell me what is wrong with array copying I will use java.
Luke Skywalker is offline   Reply With Quote
Old 08-06-09, 02:18 AM   #56
Platinum Member
 
Join Date: Sep 2008
Posts: 3,140
Rep Power: 10
Punch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to all
Default

Quote:
Originally Posted by Luke View Post
Now I am using C++. So that farce can help me.



Of course tell me why array is not copying.
can you try with 4 instead of xxx.length.
Punch Farce is offline   Reply With Quote
Old 08-06-09, 02:18 AM   #57
newprouser
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by farce View Post
"pri.c" 35 lines, 432 characters
> !cc
cc pri.c
> a.out


Segmentation Fault (core dumped)
>

farce, are linux C and borland C the same ? with respect to syntax and all
  Reply With Quote
Old 08-06-09, 02:21 AM   #58
Jedi knight
 
Luke Skywalker's Avatar
 
Join Date: Jul 2009
Location: IBF
Age: 21
Posts: 1,818
Rep Power: 5
Luke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the rough
Default

Again getting this
a e i m
b f j n
c g k o
d h l p
class Math
{
public static void main(String[] args)
{

char[] charArray={'a','b','c','d','e','f','g','h','i','j' ,'k','l','m','n','o','p'};
char[][] char2DArray=new char[4][4];
char[][] a=new char[4][4];


int c=0;
for(int d=0; d<char2DArray.length; d++){
for(int b=0; b<char2DArray[d].length; b++){


char2DArray[b][d] = (char)charArray[c];

c ++;
}}



for(int i = 0; i <= 3; i++) {
System.out.print("");
for(int j = 0; j <= 3; j++) {
System.out.print(" " + char2DArray[i][j]);
}
System.out.println("");
}
System.out.println();
}


}

Situation solve ,able to copy now trying to produce as given

Last edited by Luke Skywalker; 08-06-09 at 02:21 AM. Reason: Automerged Doublepost
Luke Skywalker is offline   Reply With Quote
Old 08-06-09, 02:22 AM   #59
Platinum Member
 
Join Date: Sep 2008
Posts: 3,140
Rep Power: 10
Punch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to allPunch Farce is a name known to all
Default

Quote:
Originally Posted by newprouser View Post
farce, are linux C and borland C the same ? with respect to syntax and all
should be, I am not sure though.

-F
Punch Farce is offline   Reply With Quote
Old 08-06-09, 02:25 AM   #60
Jedi knight
 
Luke Skywalker's Avatar
 
Join Date: Jul 2009
Location: IBF
Age: 21
Posts: 1,818
Rep Power: 5
Luke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the roughLuke Skywalker is a jewel in the rough
Default

Quote:
Originally Posted by farce View Post
can you try with 4 instead of xxx.length.
In which line?
Luke Skywalker is offline   Reply With Quote
Reply

Tags
challenge, programming

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may 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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Vote: would you like to have a programming section in IBF ? newprouser Suggestions and Complaints 30 08-30-09 12:56 AM
Java Programming : Doubts newprouser Windows 20 08-19-09 11:20 PM
Tata Sky Plus challenge devrajofjaipur Tata sky 2 05-20-09 01:50 PM
Any how to videos for Flash Programming? vishnu54 Windows 0 05-06-09 05:28 PM


All times are GMT +5.5. The time now is 06:17 AM.


India Broadband Forum