Latest topics
» Omg this server with the website is still alive :oby Razor Sat Nov 23, 2024 8:26 pm
» [Solved] Help & Support
by VK.Angel.OfDeath Thu Oct 24, 2024 7:02 pm
» [Solved] reset password
by VK.Angel.OfDeath Thu Oct 24, 2024 6:58 pm
» [Accepted] Report - Abanoub^
by VK.Angel.OfDeath Thu Oct 24, 2024 6:42 pm
» [Accepted] Unban appeal - hasan
by D4rKR420R Fri Oct 18, 2024 10:06 pm
» [Solved] Report - BelondiOscar
by SJIsNotHere Fri Oct 11, 2024 1:21 pm
» [Solved] Geogeo - Stats Transfer
by SJIsNotHere Tue Oct 01, 2024 5:50 pm
» [Solved] Kindly Re-solve it
by SJIsNotHere Wed Sep 25, 2024 9:55 am
» [Solved] Geogeo - Stats Transfer
by SJIsNotHere Wed Sep 25, 2024 8:10 am
» Matija_Todorovic returns after 3 years of absence
by UmaR Sun Sep 01, 2024 5:55 am
» [Solved] Signature^-Stats transfer
by UmaR Wed Aug 21, 2024 2:38 pm
» [Denied] Admin Application - MK14
by UmaR Fri Aug 16, 2024 8:44 pm
» [Solved] Reset my password pls
by VK.Angel.OfDeath Wed Aug 14, 2024 6:44 am
» Old member back from the dead
by Neptune Mon Aug 12, 2024 9:39 pm
» Vice War X Gameplay | BadDiamondArtz VCMP
by UmaR Thu Jul 18, 2024 10:00 am
» [Solved] RESET PASSWORD
by UmaR Fri Jul 12, 2024 3:29 pm
» [Solved]Transfer Application - Hazard
by SJIsNotHere Wed Jul 03, 2024 10:56 am
» DARKRAZOR RESPONDE MI MENSAJE!!!
by Veterano789 Wed Jul 03, 2024 1:59 am
» Vice War X: The Starfish Showdown
by =FF=B00M_B00M^ Thu Jun 27, 2024 6:17 pm
» Fatal Force - F2
by Mr.Moon Wed Jun 26, 2024 7:18 am
» Stat Transfer Application - SuFyastiC
by D4rKR420R Tue Jun 04, 2024 10:07 pm
» [Accepted] Unban Appeal
by VK.Angel.OfDeath Sun Mar 31, 2024 8:29 am
» [Solved] Password Reset
by VK.Angel.OfDeath Sat Mar 23, 2024 9:32 pm
» Ramadan Mubarak in Advance
by Shafin Sat Mar 23, 2024 1:52 pm
» Illegal Immigration | Old Memories | 2017
by ilemius Fri Feb 09, 2024 5:25 pm
» VKs and VCMP Previews
by SJIsNotHere Sat Jan 20, 2024 1:51 pm
» The Resurgence 4th Year of Anniversary!
by Ninja Tue Jan 16, 2024 10:30 am
» [Solved]Stats Transfer application - Shado[W]^
by SJIsNotHere Mon Nov 27, 2023 5:06 pm
» Hi to all my good friends
by VK.Angel.OfDeath Sat Nov 18, 2023 9:04 am
» [Closed] Admin Application - F2.Ninja
by VK.Angel.OfDeath Sat Nov 18, 2023 8:49 am
Top posters
ЧК. (8555) | ||||
VK.Angel.OfDeath (6466) | ||||
=SdS=KrlozZ... (6433) | ||||
D4rKR420R (5473) | ||||
=KF=Thunder^ (5405) | ||||
Pavonis (5197) | ||||
SJIsNotHere (4432) | ||||
Emma (4261) | ||||
Vipe[R] (3756) | ||||
47. (3705) |
Statistics
We have 1978 registered usersThe newest registered user is kodaklyve
Our users have posted a total of 217907 messages in 16831 subjects
Most Viewed Topics
Top posting users this week
No user |
Programming Topic - Official One
+4
=SdS=KrlozZ...
Chuck Norris
EK.CrystalBlue
Zurix
8 posters
Page 1 of 1
Programming Topic - Official One
Ok hello this topic made for Programmers becuz crys its not good at maths so to be fair we made that topic
Rules
No Spam
No [C# - Squrriel - C++ - PHP] Joking xD
No Stupid Question or Answers Pls
Write the programming language next to the answer
First my Queston
Write a Code to Read HTTP from a site [Write it in C# or VB.net or Jave , no another lang]
Rules
No Spam
No [C# - Squrriel - C++ - PHP] Joking xD
No Stupid Question or Answers Pls
Write the programming language next to the answer
First my Queston
Write a Code to Read HTTP from a site [Write it in C# or VB.net or Jave , no another lang]
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
C#
What does this print [Squirrel x32]
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
What does this print [Squirrel x32]
- Code:
print((2147483647 + 1) + "");
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
:v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :v
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :v
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
- This only works with signed 32-bit integers
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
Well... let's wait for angle to do that.Zeyad_Ahmed wrote:i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
In the meantime...
- BIG HINT:
- Arithmetic overflow
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
EK.CrystalBlue wrote:Well... let's wait for angle to do that.Zeyad_Ahmed wrote:i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
In the meantime...
- BIG HINT:
Arithmetic overflow
My guess would've been overflow, but since you said that in your hint I assume the number is going to be negative when it overflows.
Re: Programming Topic - Official One
Correct, but you still have to tell us that numberChuck Norris wrote:EK.CrystalBlue wrote:Well... let's wait for angle to do that.Zeyad_Ahmed wrote:i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
In the meantime...
- BIG HINT:
Arithmetic overflow
My guess would've been overflow, but since you said that in your hint I assume the number is going to be negative when it overflows.
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
EK.CrystalBlue wrote:Correct, but you still have to tell us that numberChuck Norris wrote:EK.CrystalBlue wrote:Well... let's wait for angle to do that.Zeyad_Ahmed wrote:i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
In the meantime...
- BIG HINT:
Arithmetic overflow
My guess would've been overflow, but since you said that in your hint I assume the number is going to be negative when it overflows.
Let's do some math now shall we. If we got 32 bits it means that the highest value is (2^32) - 1 = 4294967295 for unsigned. But computers are using two complements which means that the most significant bit is negative and equal to -2^31. The highest positive number would then be: 2^31 - 1 (because the we are using one bit for the sign) = 2147483647 (the number you got). When an overflow occurs the bits will change from 0 followed by 31 1's to 1 followed by 31 0's. That means that the number will be - 2^31 = - 2147483648.
I Believe that's correct.
Re: Programming Topic - Official One
Congratulations, correct answer.Chuck Norris wrote:EK.CrystalBlue wrote:Correct, but you still have to tell us that numberChuck Norris wrote:EK.CrystalBlue wrote:Well... let's wait for angle to do that.Zeyad_Ahmed wrote:i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
In the meantime...
- BIG HINT:
Arithmetic overflow
My guess would've been overflow, but since you said that in your hint I assume the number is going to be negative when it overflows.
Let's do some math now shall we. If we got 32 bits it means that the highest value is (2^32) - 1 = 4294967295 for unsigned. But computers are using two complements which means that the most significant bit is negative and equal to -2^31. The highest positive number would then be: 2^31 - 1 (because the we are using one bit for the sign) = 2147483647 (the number you got). When an overflow occurs the bits will change from 0 followed by 31 1's to 1 followed by 31 0's. That means that the number will be - 2^31 = - 2147483648.
I Believe that's correct.
Now ask your question...
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
EK.CrystalBlue wrote:Congratulations, correct answer.Chuck Norris wrote:EK.CrystalBlue wrote:Correct, but you still have to tell us that numberChuck Norris wrote:EK.CrystalBlue wrote:Well... let's wait for angle to do that.Zeyad_Ahmed wrote:i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
In the meantime...
- BIG HINT:
Arithmetic overflow
My guess would've been overflow, but since you said that in your hint I assume the number is going to be negative when it overflows.
Let's do some math now shall we. If we got 32 bits it means that the highest value is (2^32) - 1 = 4294967295 for unsigned. But computers are using two complements which means that the most significant bit is negative and equal to -2^31. The highest positive number would then be: 2^31 - 1 (because the we are using one bit for the sign) = 2147483647 (the number you got). When an overflow occurs the bits will change from 0 followed by 31 1's to 1 followed by 31 0's. That means that the number will be - 2^31 = - 2147483648.
I Believe that's correct.
Now ask your question...
What's the difference between 50/5 compared to 50 * 0.2 in terms of performance.
Re: Programming Topic - Official One
wow that is ultimate quoteChuck Norris wrote:EK.CrystalBlue wrote:Congratulations, correct answer.Chuck Norris wrote:EK.CrystalBlue wrote:Correct, but you still have to tell us that numberChuck Norris wrote:EK.CrystalBlue wrote:Well... let's wait for angle to do that.Zeyad_Ahmed wrote:i give up make another question :vEK.CrystalBlue wrote:Still wrongZeyad_Ahmed wrote:2147483648 right? :cEK.CrystalBlue wrote:!!!Zeyad_Ahmed wrote:21474836471 because you made the value in StringEK.CrystalBlue wrote:No, my question included code, I said that code was in Squirrel. This, btw, could be converted to any x32 language. For example:Zeyad_Ahmed wrote::v as iam not good at C# but i see it goodEK.CrystalBlue wrote:C#
- Code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://vkserver.forumotion.com/");
request.AutomaticDecompression = DecompressionMethods.GZip;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
StreamReader strreader = new StreamReader(new Stream);
return strreader.ReadToEnd();
let me answer yours
in vb.net
lol it in squrriel :v pls make multilanguage choice :vVB.Net.
- Code:
MessageBox.Show((2147483647 + 1).ToString())
You just need to answer what does that code result in, on console in squirrels case and on a messagebox in that VB.Net conversion I just made above.
Mine Now
Write a code that make computer shutdown after 4 seconds [in C# or VB.net]
Wrong answer
Btw, the add was between int32s, not strings, since we converted it to string after the operation
btw answer my question is above
- HINT:
This only works with signed 32-bit integers
In the meantime...
- BIG HINT:
Arithmetic overflow
My guess would've been overflow, but since you said that in your hint I assume the number is going to be negative when it overflows.
Let's do some math now shall we. If we got 32 bits it means that the highest value is (2^32) - 1 = 4294967295 for unsigned. But computers are using two complements which means that the most significant bit is negative and equal to -2^31. The highest positive number would then be: 2^31 - 1 (because the we are using one bit for the sign) = 2147483647 (the number you got). When an overflow occurs the bits will change from 0 followed by 31 1's to 1 followed by 31 0's. That means that the number will be - 2^31 = - 2147483648.
I Believe that's correct.
Now ask your question...
What's the difference between 50/5 compared to 50 * 0.2 in terms of performance.
:v btw
50/5 = 25 and 50*0.2 = 25
btw is that math topic :v
man that topic is for writing code not for.. ah :v
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
Lol OMG zeyad the question was about the performance . 50/5 = 10 and 50*0.2 = 10 also lol.
Re: Programming Topic - Official One
did i wrote 50/0.2 = 25 what a stupid :vChuck Norris wrote:Lol OMG zeyad the question was about the performance . 50/5 = 10 and 50*0.2 = 10 also lol.
i was think it 0.5 :v
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
Nub programming :p
=SdS=KrlozZ...- Ultra Legendary
- Gender :
Posts : 6433
Points : 7855
Reputation : 103
Join date : 2016-02-13
Age : 26
Location : Here >:)
Re: Programming Topic - Official One
srry zeyad i came late xD , omg many qsk's here , @Chuck Noris i lub the way you answar crystal qsk . you secretly professional . this too low for you pls xD
Topic Locked as show's lead to childish fight's . (humor)
Topic Locked as show's lead to childish fight's . (humor)
Lahhami^- Legendary Member
- Gender :
Posts : 1250
Points : 1677
Reputation : 2
Join date : 2016-08-06
Age : 29
Location : Opssi World!
Re: Programming Topic - Official One
IIRC, integers can be processed faster than decimals.
So, in terms of performance, 50/5 is faster than 50 * 0.2
But, technically, you won't see much difference.
So, in terms of performance, 50/5 is faster than 50 * 0.2
But, technically, you won't see much difference.
KAKAN- Ultra Legendary
- Gender :
Posts : 3466
Points : 4011
Reputation : 16
Join date : 2014-09-28
Age : 21
Location : World
Re: Programming Topic - Official One
However, multiplication takes up much fewer operations than divisions.KAKAN wrote:IIRC, integers can be processed faster than decimals.
So, in terms of performance, 50/5 is faster than 50 * 0.2
But, technically, you won't see much difference.
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
Write a code for send "Duke" by TCP socket [C# or VB.net]
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
You weren't the one supposed to be asking the question...Zeyad_Ahmed wrote:Write a code for send "Duke" by TCP socket [C# or VB.net]
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
KAKAN wrote:IIRC, integers can be processed faster than decimals.
So, in terms of performance, 50/5 is faster than 50 * 0.2
But, technically, you won't see much difference.
Division takes a lot of Clock cycles to complete KAKAN, I've done hardware programming, It's a pain in the ass. I don't use divisions anymore when I don't have to.
Re: Programming Topic - Official One
i asked a question becuz no one IS ASKING !!!!EK.CrystalBlue wrote:You weren't the one supposed to be asking the question...Zeyad_Ahmed wrote:Write a code for send "Duke" by TCP socket [C# or VB.net]
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
This is one of the confusing topics I ever seen Me a nub programmer Zeyad, you owe me training last time :/
_______________________________________
If you need any help in situations in the server, contact me on my Facebook "DarkRaZoR VCMP" & I'll do my best to support you at all cost. I highly recommend it. [You must be registered and logged in to see this image.]
D4rKR420R- Management
-
Gender :
Posts : 5473
Points : 6428
Reputation : 76
Join date : 2016-06-25
Age : 25
Location : Dallas, Texas, USA
Re: Programming Topic - Official One
got yoChuck Norris wrote:KAKAN wrote:IIRC, integers can be processed faster than decimals.
So, in terms of performance, 50/5 is faster than 50 * 0.2
But, technically, you won't see much difference.
Division takes a lot of Clock cycles to complete KAKAN, I've done hardware programming, It's a pain in the ass. I don't use divisions anymore when I don't have to.
By TCP, what do you mean? MQTT is based on TCP. HTTP is based on TCP, so which one?Zeyad_Ahmed wrote:Write a code for send "Duke" by TCP socket [C# or VB.net]
Anyways:-
- Code:
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Net.Sockets;
public class clnt {
public static void Main() {
try {
TcpClient tcpclnt = new TcpClient();
Console.WriteLine("Connecting.....");
tcpclnt.Connect("172.21.5.99",8001);
// use the ipaddress as in the server program
Console.WriteLine("Connected");
Console.Write("Duke sucks!!!!");
String str= "Duke";
Stream stm = tcpclnt.GetStream();
ASCIIEncoding asen= new ASCIIEncoding();
byte[] ba=asen.GetBytes(str);
Console.WriteLine("Transmitting.....");
stm.Write(ba,0,ba.Length);
tcpclnt.Close();
}
catch (Exception e) {
Console.WriteLine("Error..... " + e.StackTrace);
}
}
}
KAKAN- Ultra Legendary
- Gender :
Posts : 3466
Points : 4011
Reputation : 16
Join date : 2014-09-28
Age : 21
Location : World
Re: Programming Topic - Official One
Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
Squirrel interprets your program rather then compile and execute.EK.CrystalBlue wrote:Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
So, it first executes the first line of the code without compiling the whole code, that means, function1 is not yet present in the global table and so doesn't work.
My question: How to "PRINT ALL THE VALUES OF AN ARRAY WITHOUT USING ANY LOOP CONTROL STATEMENTS" Languages allowed: JS or Squirrel or any other dynamic language.
Pretty simple one.
KAKAN- Ultra Legendary
- Gender :
Posts : 3466
Points : 4011
Reputation : 16
Join date : 2014-09-28
Age : 21
Location : World
Re: Programming Topic - Official One
KAKAN wrote:Squirrel interprets your program rather then compile and execute.EK.CrystalBlue wrote:Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
So, it first executes the first line of the code without compiling the whole code, that means, function1 is not yet present in the global table and so doesn't work.
My question: How to "PRINT ALL THE VALUES OF AN ARRAY WITHOUT USING ANY LOOP CONTROL STATEMENTS" Languages allowed: JS or Squirrel or any other dynamic language.
Pretty simple one.
- Code:
local array = ["KAKAN", "Pitch", "v0t"];
array.apply(function (v) {print(v); return v;});
- Code:
@
@@
@@@
@@@@
p.s. the hardest part of these questions is coming up with your own question
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
EK.CrystalBlue wrote:Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
because its not in a script :V
=SdS=KrlozZ...- Ultra Legendary
- Gender :
Posts : 6433
Points : 7855
Reputation : 103
Join date : 2016-02-13
Age : 26
Location : Here >:)
Re: Programming Topic - Official One
1. This question was already answered.=SdS=KrlozZ... wrote:EK.CrystalBlue wrote:Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
because its not in a script :V
2. Wrong. It's because at the time of the call to function1(), function1 wasn't declared.
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
EK.CrystalBlue wrote:1. This question was already answered.=SdS=KrlozZ... wrote:EK.CrystalBlue wrote:Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
because its not in a script :V
2. Wrong. It's because at the time of the call to function1(), function1 wasn't declared.
XD i though the answer was wrong xd
=SdS=KrlozZ...- Ultra Legendary
- Gender :
Posts : 6433
Points : 7855
Reputation : 103
Join date : 2016-02-13
Age : 26
Location : Here >:)
Re: Programming Topic - Official One
Please write question or i will ask a one
- Code:
Dim Flake As String
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
Zeyad_Ahmed wrote:Please write question or i will ask a onewrite the value of "flake" when we get the value of physical memory :v?
- Code:
Dim Flake As String
Put a new one :v
=SdS=KrlozZ...- Ultra Legendary
- Gender :
Posts : 6433
Points : 7855
Reputation : 103
Join date : 2016-02-13
Age : 26
Location : Here >:)
Re: Programming Topic - Official One
EK.CrystalBlue wrote:KAKAN wrote:Squirrel interprets your program rather then compile and execute.EK.CrystalBlue wrote:Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
So, it first executes the first line of the code without compiling the whole code, that means, function1 is not yet present in the global table and so doesn't work.
My question: How to "PRINT ALL THE VALUES OF AN ARRAY WITHOUT USING ANY LOOP CONTROL STATEMENTS" Languages allowed: JS or Squirrel or any other dynamic language.
Pretty simple one.My question: How do you print a triangle like this:
- Code:
local array = ["KAKAN", "Pitch", "v0t"];
array.apply(function (v) {print(v); return v;});with a specified height using a foreach loop using squirrel
- Code:
@
@@
@@@
@@@@
p.s. the hardest part of these questions is coming up with your own question
v0t?Zeyad_Ahmed wrote:Please write question or i will ask a onewrite the value of "flake" when we get the value of physical memory :v?
- Code:
Dim Flake As String
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
EK.CrystalBlue wrote:EK.CrystalBlue wrote:KAKAN wrote:Squirrel interprets your program rather then compile and execute.EK.CrystalBlue wrote:Okay, my question again.
Figure out why this code doesn't work.
[squirrel]
- Code:
function1();
function function1()
{
print("Successful");
}
So, it first executes the first line of the code without compiling the whole code, that means, function1 is not yet present in the global table and so doesn't work.
My question: How to "PRINT ALL THE VALUES OF AN ARRAY WITHOUT USING ANY LOOP CONTROL STATEMENTS" Languages allowed: JS or Squirrel or any other dynamic language.
Pretty simple one.My question: How do you print a triangle like this:
- Code:
local array = ["KAKAN", "Pitch", "v0t"];
array.apply(function (v) {print(v); return v;});with a specified height using a foreach loop using squirrel
- Code:
@
@@
@@@
@@@@
p.s. the hardest part of these questions is coming up with your own questionv0t?Zeyad_Ahmed wrote:Please write question or i will ask a onewrite the value of "flake" when we get the value of physical memory :v?
- Code:
Dim Flake As String
just put a new question
=SdS=KrlozZ...- Ultra Legendary
- Gender :
Posts : 6433
Points : 7855
Reputation : 103
Join date : 2016-02-13
Age : 26
Location : Here >:)
Re: Programming Topic - Official One
Carl has two apples, write a program that steals one of Carl's apple. AI required.
VK.Angel.OfDeath- Server Owner & Forum Admin
- Chuck NorrisedYou been norrised.
- Posts : 6466
Points : 9323
Reputation : 127
Join date : 2012-10-28
Age : 30
Location : Sweden
Re: Programming Topic - Official One
VK.Angel.OfDeath wrote:Carl has two apples, write a program that steals one of Carl's apple. AI required.
Program Done ,Here Carlos Apple's Completly Program !
Enjoy it With some Sturct's and pointer's .
i put some note's almost each Command's /Function's/sturct's .
- Code:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> // printf & scanf
#include <stdlib.h> // malloc, free functions
#include <math.h> // sqrt,pow,abs functions
// point
typedef struct {
double Apple_precent;
double Apple_Kind;
}CarlApples;
/* functions prototype */
Point* setApples(int *pnts);
/* main function */
oid main() {
CarlApples *ps;
int pnts;
// setting array of points
ps = setApples(&pnts);
// printing them out before sorting
printf("\nPoints Apple's before sorting:\n\n");
printApples(ps,pnts);
// sorting Apples
sortApples(ps,pnts);
// printing them out after sorting
printf("\nPoints after sorting:\n\n");
printApples(ps, pnts);
// freeing up Apples array
free(ps);
}
Point* setApples(int *pnts) {
int i;
CarlApples *pArr;
printf("How many points do u wish to generate? ");
scanf("%d", pnts);
pArr = (Point*)malloc(sizeof(CarlApples)*(*pnts));
for (i = 0; i < *pnts; i++) {
printf("CarlApple(%d):\n", i + 1);
printf("Enter first quantity:");
scanf("%lf", &pArr[i].x);
printf("Enter second quantity:");
scanf("%lf", &pArr[i].y);
printf("\n");
}
return pArr;
}
void sortApples(Point *pArr, int pnts) {
int i, j;
// sorting using bubble sort algorithm
for (i = 1; i < pnts; i++)
for (j = 0; j < pnts - i; j++)
if (compareApple(&pArr[j], &pArr[j + 1]) == 1)
SwapApples(&pArr[j], &pArr[j + 1]);
}
// this function compares between 2 given Apple's
int compareApple(Point *p1,Point *p2) {
CarlApples origin = { 0,0 };
double d1 = distance(p1, &origin);
double d2 = distance(p2, &origin);
if ((d1 - d2) < 0.0001)
return 0;
if (d1 > d2)
return 1;
return 2;
}
// this function swaps between 2 given Apple's
void SwapApples(Point *p1, Point *p2) {
CarlApples tmp;
tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
P.S : It was homework Univ and i have many program's that i Made . i just made some edit's but acually i made it , if anyone want to ask about this code then ask and dont shy
#LahhamOnService
Lahhami^- Legendary Member
- Gender :
Posts : 1250
Points : 1677
Reputation : 2
Join date : 2016-08-06
Age : 29
Location : Opssi World!
Re: Programming Topic - Official One
C# is so much like Java, I just noticed some different importing keywords nothing else.
They use using and I use import
They use using and I use import
Guest- Guest
Re: Programming Topic - Official One
VB.net are not simmilar in Syntax but they have the same .net frameworkBABA1 wrote:C# is so much like Java, I just noticed some different importing keywords nothing else.
They use using and I use import
in vb.net i use Imports :v
in C# they write [ (Data Type) (.....) = (value)]
in vb.net we write Dim (.....) As (DataType) = (value)
Let me ask a question
If you have a file called andrisucks.rtf and you have to open it in richtextbox with plain text format
write the code :v
Zurix- Legendary Member
- Gender :
Posts : 1338
Points : 1589
Reputation : -11
Join date : 2016-05-15
Age : 22
Location : Discord
Re: Programming Topic - Official One
[EK]KillerLaham wrote:VK.Angel.OfDeath wrote:Carl has two apples, write a program that steals one of Carl's apple. AI required.
Program Done ,Here Carlos Apple's Completly Program !
Enjoy it With some Sturct's and pointer's .
i put some note's almost each Command's /Function's/sturct's .
- Code:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> // printf & scanf
#include <stdlib.h> // malloc, free functions
#include <math.h> // sqrt,pow,abs functions
// point
typedef struct {
double Apple_precent;
double Apple_Kind;
}CarlApples;
/* functions prototype */
Point* setApples(int *pnts);
/* main function */
oid main() {
CarlApples *ps;
int pnts;
// setting array of points
ps = setApples(&pnts);
// printing them out before sorting
printf("\nPoints Apple's before sorting:\n\n");
printApples(ps,pnts);
// sorting Apples
sortApples(ps,pnts);
// printing them out after sorting
printf("\nPoints after sorting:\n\n");
printApples(ps, pnts);
// freeing up Apples array
free(ps);
}
Point* setApples(int *pnts) {
int i;
CarlApples *pArr;
printf("How many points do u wish to generate? ");
scanf("%d", pnts);
pArr = (Point*)malloc(sizeof(CarlApples)*(*pnts));
for (i = 0; i < *pnts; i++) {
printf("CarlApple(%d):\n", i + 1);
printf("Enter first quantity:");
scanf("%lf", &pArr[i].x);
printf("Enter second quantity:");
scanf("%lf", &pArr[i].y);
printf("\n");
}
return pArr;
}
void sortApples(Point *pArr, int pnts) {
int i, j;
// sorting using bubble sort algorithm
for (i = 1; i < pnts; i++)
for (j = 0; j < pnts - i; j++)
if (compareApple(&pArr[j], &pArr[j + 1]) == 1)
SwapApples(&pArr[j], &pArr[j + 1]);
}
// this function compares between 2 given Apple's
int compareApple(Point *p1,Point *p2) {
CarlApples origin = { 0,0 };
double d1 = distance(p1, &origin);
double d2 = distance(p2, &origin);
if ((d1 - d2) < 0.0001)
return 0;
if (d1 > d2)
return 1;
return 2;
}
// this function swaps between 2 given Apple's
void SwapApples(Point *p1, Point *p2) {
CarlApples tmp;
tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
P.S : It was homework Univ and i have many program's that i Made . i just made some edit's but acually i made it , if anyone want to ask about this code then ask and dont shy
#LahhamOnService
NOOO!!! WAIT NO PLS! My dear apple TnT
=SdS=KrlozZ...- Ultra Legendary
- Gender :
Posts : 6433
Points : 7855
Reputation : 103
Join date : 2016-02-13
Age : 26
Location : Here >:)
Re: Programming Topic - Official One
oid main()?[EK]KillerLaham wrote:VK.Angel.OfDeath wrote:Carl has two apples, write a program that steals one of Carl's apple. AI required.
Program Done ,Here Carlos Apple's Completly Program !
Enjoy it With some Sturct's and pointer's .
i put some note's almost each Command's /Function's/sturct's .
- Code:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> // printf & scanf
#include <stdlib.h> // malloc, free functions
#include <math.h> // sqrt,pow,abs functions
// point
typedef struct {
double Apple_precent;
double Apple_Kind;
}CarlApples;
/* functions prototype */
Point* setApples(int *pnts);
/* main function */
oid main() {
CarlApples *ps;
int pnts;
// setting array of points
ps = setApples(&pnts);
// printing them out before sorting
printf("\nPoints Apple's before sorting:\n\n");
printApples(ps,pnts);
// sorting Apples
sortApples(ps,pnts);
// printing them out after sorting
printf("\nPoints after sorting:\n\n");
printApples(ps, pnts);
// freeing up Apples array
free(ps);
}
Point* setApples(int *pnts) {
int i;
CarlApples *pArr;
printf("How many points do u wish to generate? ");
scanf("%d", pnts);
pArr = (Point*)malloc(sizeof(CarlApples)*(*pnts));
for (i = 0; i < *pnts; i++) {
printf("CarlApple(%d):\n", i + 1);
printf("Enter first quantity:");
scanf("%lf", &pArr[i].x);
printf("Enter second quantity:");
scanf("%lf", &pArr[i].y);
printf("\n");
}
return pArr;
}
void sortApples(Point *pArr, int pnts) {
int i, j;
// sorting using bubble sort algorithm
for (i = 1; i < pnts; i++)
for (j = 0; j < pnts - i; j++)
if (compareApple(&pArr[j], &pArr[j + 1]) == 1)
SwapApples(&pArr[j], &pArr[j + 1]);
}
// this function compares between 2 given Apple's
int compareApple(Point *p1,Point *p2) {
CarlApples origin = { 0,0 };
double d1 = distance(p1, &origin);
double d2 = distance(p2, &origin);
if ((d1 - d2) < 0.0001)
return 0;
if (d1 > d2)
return 1;
return 2;
}
// this function swaps between 2 given Apple's
void SwapApples(Point *p1, Point *p2) {
CarlApples tmp;
tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
P.S : It was homework Univ and i have many program's that i Made . i just made some edit's but acually i made it , if anyone want to ask about this code then ask and dont shy
#LahhamOnService
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
Another thing, it's supposed to be int main, not [v]oid main.
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
EK.CrystalBlue wrote:Another thing, it's supposed to be int main, not [v]oid main.
But main doesn't return anything, why should it be an int?
Re: Programming Topic - Official One
It's just more standard to use int main instead of void mainChuck Norris wrote:EK.CrystalBlue wrote:Another thing, it's supposed to be int main, not [v]oid main.
But main doesn't return anything, why should it be an int?
EK.CrystalBlue- Deputy Chief of the Community
-
Posts : 3621
Points : 4218
Reputation : 28
Join date : 2012-10-31
Age : 31
Location : I am CRYSTAL u never found me!!!!!
Re: Programming Topic - Official One
Using void works, and you should use it when you don't want to return something.EK.CrystalBlue wrote:It's just more standard to use int main instead of void mainChuck Norris wrote:EK.CrystalBlue wrote:Another thing, it's supposed to be int main, not [v]oid main.
But main doesn't return anything, why should it be an int?
KAKAN- Ultra Legendary
- Gender :
Posts : 3466
Points : 4011
Reputation : 16
Join date : 2014-09-28
Age : 21
Location : World
Re: Programming Topic - Official One
firstly , i miss that letter 'V' , its acually void .(or cousin void )EK.CrystalBlue wrote:It's just more standard to use int main instead of void mainChuck Norris wrote:EK.CrystalBlue wrote:Another thing, it's supposed to be int main, not [v]oid main.
But main doesn't return anything, why should it be an int?
second , main dont have to be int and "void main" more standard than "int main" .(as i dont see int main before and main dont return something)
Third ,
Void = When you wanna print something or wanna make some change's on variables (by sending variable/s address like " &x ")
int/double/int*/float*/Struct*/ : when you want to Create something then Return it , for example let's say we want's function will create char array not by " char arr[N]; " by(Dynamic allocation) and then return the address of new array (Address is'nt like int/float/etc , its int*/float*/etc ) .
(1)
this is the function itself , so on Void main you can send anysize you want .
- Code:
Char * CreatingNewCharArr(Int Size)
{
char *NewArray = (char *) malloc (sizeof(char) * Size); // Dynamic allocation
return NewArray ;
}
(2.1)
another qsk that say's to recieve 5 number's on array then Return sum/multOfthem(remmeber its 2 value's not 1)
- Code:
Void PrintSumMul()
{
int num,sum=0,mult=1;
for(i=0;i<=4;i++)
{
scanf(" %d",&num); // recieving
sum+=num;
mul*=num;
}
printf("the sum iz : %d " , sum);
printf("the Mult iz : %d " , mul);
(2.2)
Same qsk But return 2 value's(By address's) and then you can print value's on Main func .
- Code:
Void ChangeSumMulByAddress(int *sum,int *mul)
{
for(i=0;i<=4;i++)
{
scanf(" %d",&num); // recieving
(*sum)+=num;
(*mul)*=num;
}
P.S: if you dont knew what pointer's iz then its kind like hard to understand .
Lahhami^- Legendary Member
- Gender :
Posts : 1250
Points : 1677
Reputation : 2
Join date : 2016-08-06
Age : 29
Location : Opssi World!
Similar topics
» [Forum game] Programming topic
» VK SECRETS OFFICIAL TOPIC.
» Help and Support of Vks Official server on official whatsapp group
» Math Topic 2 : The Topic of Nerds!
» 72th Anniversary of dropping Hiroshima
» VK SECRETS OFFICIAL TOPIC.
» Help and Support of Vks Official server on official whatsapp group
» Math Topic 2 : The Topic of Nerds!
» 72th Anniversary of dropping Hiroshima
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum