# Off-Topic Discussion > The Lounge > Tech Talk >  >  How Many Programming Langauges Do You Know?

## Pyrofan1

I know:PHPSQLC#CC++Visual basicLuaPythonPbasicSpinJavascriptHTMLXMLBrainfuck@55 [email protected]Javahow about you guys?

----------


## MSG

1. php
2. ???
3. PROFIT&#33;

----------


## lord soth

Is this just how many I know ABOUT? because I&#39;m pretty sure no sane person programs in Brainfuck at all. Are you sure you actually have expertise in those languages, or you have just made a single applet, or compiled a single program with them?

BTW, PHP SQL, HTML, XML, etc. Are not programming languages.

----------


## MSG

> BTW, PHP SQL, HTML, XML, etc. Are not programming languages.
> [/b]



visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY

----------


## Pyrofan1

SQL-structured query *language*
XML-Extensible Markup *Language*
HTML-HyperText Markup *Language*
and how is PHP not a language? and i do have expertise in all of them

----------


## lord soth

I happen to know that MSG only &#39;programs&#39; with PHP. Judge his sanity for yourselves:





> visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic visual basic khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly khelly KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY KHELLY[/b]

----------


## Pyrofan1

I program in PHP and have you noticed that Invision Board, phpBB, SMF and lots of other sites use PHP.

----------


## MSG

From the internet itself (if it&#39;s on the internet, it MUST be true):





> ...Visual Basic currently competes with PHP and C++ as the third most popular *programming language* behind Java and C.[/b]



http://en.wikipedia.org/wiki/Visual_Basic

----------


## lord soth

OK, let us say that to be considered a programming languages, It must possess variables. What would C++ be without variables? It would be almost as useless as MSG&#39;s attempt at a post.

HTML, XML, and mySQL don&#39;t use variables. I don&#39;t know about Spin and Lua, but I&#39;m too lazy to look it up.

----------


## MSG

I never said HTML, XML, and mySQL were programming languages. HTML and XML are markup languages (it&#39;s in the name), and mySQL is just a dump where you can store data. By the way, whatever happened to "php isn&#39;t a programming language"?

----------


## Ynot

stop being so elitist
any human-readable text that is used to control the operation of a machine is a programming language

whether that be compiled, interpreted or scripted

anyway

php, sql, C & C++ are te only ones I can do anything useful with

----------


## Kaniaz

I don&#39;t feel that "knowing" the syntax of a language is knowing anything. It&#39;s way too easy to learn PHP, C++ or pretty much any language&#39;s syntax and still have absolutely no idea on how to program anything useful in them or the underlying concepts behind them of variables, classes, encapsulation _whatever_.

I&#39;m pretty sure if I thought a bit, I could name 20 languages that I "know", but I can only do anything useful in about six of them maybe?C++. I learnt the syntax to this when I was about eleven, but, like I said, I had absolutely no idea what to do with it. I could make a thumpin&#39; good "Hello World" program, though. Now it&#39;s my favourite language. I don&#39;t entirely understand why people say it&#39;s hard or why they get the hots over alternative languages (I mean, come on, pointers aren&#39;t that complicated to understand) but such is life.PHP. The documentation for this language is absolutely outstanding and it didn&#39;t take long to learn and actually use for a good purpose at all. Not to mention the syntax is quite a lot like C++&#39;s, and I think one of the main reasons I&#39;d recommend it to someone who wants to get into programming is because there&#39;s no strict type checking. &#036;myVariable can be a string, integer and anything else all at once. Yeah that can make problems, but it works for most purposes.SQL. This isn&#39;t really a language at all, more a bunch of keywords, but that wouldn&#39;t stop me from listing it somewhere on my hypothetical CV. That and SQL is so useful hand in hand with PHP. There&#39;s bindings for C++, but I don&#39;t feel that it has a place in languages like that.HTML/CSS/JavaScript. I combine all three of these because I feel it&#39;s a little dumb to count them all separately. You can&#39;t make very good HTML without using CSS, and your site is a lot like cardboard these days unless you use Javascript with it all. Either way, I learned how to use this ages ago, CSS is the greatest thing on the planet and I seriously will never understand why so many sites still use tables. The freaks.I&#39;ve missed off "languages" like XML and the like. I know those, they&#39;re useful, but you don&#39;t make applications out of them and they honestly don&#39;t take long to learn at all.

Languages I have never looked at include Visual Basic (ha-ha), Java and Ruby. Countless others, probably. I have seen a little of Perl. I might like to look at LISP in the future and perhaps assembly which, while almost entirely useless in today&#39;s whimsical world of abstraction and building castles in our heads*, would be fun background knowledge. C# is up for a definite fool around with in the future, being as everyone swoons over .NET (and I&#39;d really like to know why).

*EDIT:* I just read the posts before me more closely. What the? PHP is a programming language. HTML is more of a markup language, but still has a few vestiges of programming concepts (which is why I would feel someone making a big deal out of it would be scraping the barrel).

* Anyone read "The Mythical Man Month"? Then you are not a real programmer, son&#33;

----------


## M-Cat

I know TI-BASIC ^_^. Mad easy to learn. I have too much of a life to master anything else.

----------


## Ynot

any basic language is uber leet
fuckin&#39; roxor on &#33;&#33;&#33;&#33;

erm,,,,......
yeah, about being super elitest.........
it&#39;s ok to mock basic people


*edit*
there&#39;s really a lang called arse-raper ???

----------


## Seeker

Assembly Languages - IBM370, 8080, Z80, 6512, 80x86, 990, 6800, 68000, 99000
JCL
COBOL
Basics - GW, TI, Visual, .NET
C dialects - C, C++, C#
All Texas Instruments/Siemens Industrial controller languages - About 15 of them in total
PHP

----------


## Umbrasquall

Ultimate nerd thread.

...

Right I know TI, Java, C++ and some html.

----------


## Smileyguy597

TI-83 Plus- ALL THE WAY

its fun to make games on your calculator

----------


## arby

my "real languages" that I can do something with are:

1. C

2. AS

3. Haskel (An uber-efficient, *Fully functional* (That means NO variables and NO if loops among others) language. Its really crazy yet quite fun and I suggest any programmer that is looking for new opertunities/chalenges/is bored with conventional x += 5 to try it =P)

4. VB

----------


## Ynot

> Assembly Languages - IBM370, 8080, Z80, 6512, 80x86, 990, 6800, 68000, 99000[/b]



winner

----------


## dsr

Python - my favorite language

Java - I know the syntax and am comfortable with a few APIs (I/O and Swing come to mind), but I don&#39;t have much experience with the language (no more than a year)

C++ - I know the syntax, but I have almost no experience with the language. I find Python (in conjunction with the Psyco JIT compiler) performs well enough for everything I&#39;ve needed so far and is certainly more productive. That being said, C++ is a great language and I intend to give it a go in a few years.

Perl, Bourne, and Bash - just for simple scripts

AppleScript and Objective-C (w/ Cocoa) - very little

XHTML/CSS/JavaScript/XML/XSTL/etc. - I wouldn&#39;t consider them _programming_ languages, but I know the basics of them.

Lisp - I want to learn someday. Or maybe I&#39;ll just leave that to RMS ...

As previously stated, it doesn&#39;t matter how many languages you know, it&#39;s how effective you are with those that you do know. Having no formal training and not having studied much production code, I consider myself a relative beginner in programming. However, I have a lot of general computer knowledge (primarily on Mac OS X and certain Linux distros).





> Assembly Languages - IBM370, 8080, Z80, 6512, 80x86, 990, 6800, 68000, 99000
> [/b]



Wow. I&#39;m guessing you&#39;re fluent in binary too?  ::wink::

----------


## Pyrofan1

> Wow. I&#39;m guessing you&#39;re fluent in binary too?
> [/b]



Don&#39;t you mean machine code?

----------


## dsr

> Don&#39;t you mean machine code?
> [/b]



00000001  ::wink::

----------


## arby

> 00000001 
> [/b]



00000000    :Mad:  

you liar

----------


## dsr

No, I was agreeing with Pyrofan1 that I meant machine code (which is represented in binary). 00000001 in binary is the same as 1 in decimal which is the "yes" value for a bit (a single binary digit). I admit it was a stretch. I should have responded with the ASCII code for the string "yes" in binary:

01111001
01000101
01110011

----------


## arby

> No, I was agreeing with Pyrofan1 that I meant machine code (which is represented in binary). 00000001 in binary is the same as 1 in decimal which is the "yes" value for a bit (a single binary digit). I admit it was a stretch. I should have responded with the ASCII code for the string "yes" in binary:
> 
> 01111001
> 01000101
> 01110011
> [/b]



And i replied with 00000000 which is false or "no" in binary =P

You need some studying to do young&#39;un

----------


## Kaniaz

> You need some studying to do young&#39;un[/b]



No, nope, I&#39;m pretty sure you&#39;re evenly matched in your, uh, contest.

----------


## dsr

This is a rather pointless, er, "contest." Arby, how does Haskell&#39;s performance (when compiled with GHC) compare to native code written in more mainstream languages like C or C++? I never gave Haskell any thought until I read your post, but I just checked out the wiki and it looks pretty interesting.

Kaniaz, Vim users unite&#33; _Bellum gerendum contra Emacs est._ Actually, I like GNU Emacs but find it painful on my wrists.  ::?:

----------


## arby

> This is a rather pointless, er, "contest." Arby, how does Haskell&#39;s performance (when compiled with GHC) compare to native code written in more mainstream languages like C or C++? I never gave Haskell any thought until I read your post, but I just checked out the wiki and it looks pretty interesting.
> 
> [/b]



Pointless, yes... =P oh well.

Well, i&#39;m not really sure about the specifics of why haskell is that efficient since i&#39;m not exactly a computer science graduate but I have a general idea. Heres a demo peice of code just for refernce. 

Lets use a factorial function to demonstrate.

in C:

int factorial(x){
y=1
for(i=1,i<=x,i++){
y = y*i
}
return y
}

It takes a few lines, a for loop and some variable calculations. In haskel:

fac 0 = 1
fac n | n > 0 = n * fac (n-1)

A simple recurrsion, no unneeded calculations. Plus, it looks dam sexy fitting all those lines of code into 2 or even 1 line of code:

fac n = if n > 0 then n * fac (n-1) else 1

Anyways, its not more efficient in all cases and i&#39;m really not sure what parts of it are that much better but I worked under a university computer science professor using this language and he said it was more efficient in most cases so i&#39;m assuming he knew what he was talking about XD

Anyways, if you&#39;re interested heres a good link

----------


## dsr

Actually, the C implementation would most likely be recursive, too:




```
int factorial&#40;int x&#41; {
****if &#40;x == 1 || x == 0&#41;
********return 1;
****else
********return x * factorial&#40;x - 1&#41;;
}
```


If you _really_ want 1 line:




```
int factorial&#40;int x&#41; {if &#40;x==1||x==0&#41; return 1; else return factorial&#40;x-1&#41;*x;}
```


Also, your C example doesn&#39;t use C syntax  ::evil::  

Thanks for the link. I&#39;ll check it out when I have the time. I&#39;m still curious about how Haskell&#39;s performance compares to C/C++, especially for algorithmic code. Maybe Haskell&#39;s wiki answers that somewhere.

----------


## arby

> Actually, the C implementation would most likely be recursive, too:
> 
> Also, your C example doesn&#39;t use C syntax  
> 
> [/b]



True, it could be recursive, but it wont get the full benifit because C isn&#39;t a lazy language (at least I think)

And I used pseudo code for the C portion =P I&#39;m more used to languages similar to C.

----------


## M-Cat

I started learning C++ because of this topic.

Here&#39;s my first program that checks if a number is prime. I&#39;m really angry because I just found out I could&#39;ve used a modulus operator and made it a lot shorter and faster > :Sad: 



#include <iostream>

using namespace std;

float x;
float y;
int z;

int main ();

int composite ()
{
          cout << "&#092;nCOMPOSITE";
          main ();
          }

int main()
  {
      cout << "&#092;n&#092;n-PRIME-&#092;nEnter a number to determine if it is prime.&#092;n";
      cin >> x;
      if ( x <= 0 && x &#33;= -1 )
      composite ();
      for ( z = 2; z <= ( x / 2 ); ++z )
      {
          for ( y = 2; y <= ( x / 2 ); ++y )
          {
          if ( z == ( x / y ) )
          composite ();
          }

      }
          cout << "&#092;nPRIME";
          main ();
   }


I am making a text-based rpg right now  ::D:  It&#39;s going to have colored font&#33;

----------


## Kaniaz

Do you actually call main more than once or something there? In a perfect world, there would be indentation.

Anyway, yeah, first rule of programming. If you find something is beginning to look quite ugly (like your solution and lack of modulus operator above), it&#39;s best to think to yourself, "has any other programmer possibly ever tried this before", and usually, more or less, there&#39;s a better way to do it.

----------


## M-Cat

C is a low-level language, meaning it works the same however you indent it.

I also copied and pasted, and tabs for some reason don&#39;t copy and paste into firefox.

And to answer your original question, it&#39;s because my compiler requires each function to be defined before it encounters it; in composite(), my compiler doesn&#39;t know what main() is yet, so I just have to define it before using it. I wasn&#39;t calling it twice.

Also, I feel that if I copy a program, I might as well just download it. You misunderstood my intent with this program; it&#39;s to learn, not to create an uber omgI&#39;llfindthelargestprimenumberinzahworld program. Using someone else&#39;s code doesn&#39;t help you learn. I&#39;m not looking for the best way.

I hope I wasn&#39;t too harsh :/ thanks for trying to help.

----------


## Pyrofan1

> C is a low-level language, meaning it works the same however you indent it.
> [/b]



That&#39;s not right
First of all C is not a low level language it&#39;s a medium level language
A low level language means its closer to machine language unlike a high level language like BASIC which looks more like english

----------


## M-Cat

K, well I was going by what a tutorial said, anyway.

You also completely missed the point of what I was saying :/

*realizes this is a nerd topic and leaves* haha now you&#39;ll never get my rpg  :tongue2:

----------


## Pyrofan1

> haha now you&#39;ll never get my rpg 
> [/b]



Fine, you&#39;ll never get my graphics based one.

----------


## TweaK

The fact it works the same however you indent it doesn&#39;t mean you shouldn&#39;t indent ¬_¬

----------


## lechat

Hey guys,
seems everyone is an expert here...   :smiley:  

* JAVA (J2EE or rather EE as J2EE is an obsolete term for enterprise java)
* PHP - i think this can be called prog. lang. but someone could call it just scripting lang.

* and of course a lot of stuff around the web (html, css, JS etc...)

----------


## arby

> Hey guys,
> seems everyone is an expert here...   
> [/b]



na, its just that the people who aren&#39;t experts pretend to be =P

----------


## M-Cat

> na, its just that the people who aren&#39;t experts pretend to be =P
> [/b]



Haha like me  ::D:

----------


## Kaniaz

Uh, no. Let me clear some of this up for you.





> C is a low-level language, meaning it works the same however you indent it.[/b]



All very true, and the same can be said for C++, but code is always read more times than it is written. The next person to see your code will not be able to see the structure of your program easily with for blocks etc if you do not indent in. The compiler is very loose and ultimately the code loses its indentation when it is compiled, but this does not mean that I can read machine code. Always indent it, it&#39;s much easier to read: it&#39;s easier to get into the habit now. I understand it Firefox did something weird.





> And to answer your original question, it&#39;s because my compiler requires each function to be defined before it encounters it; in composite(), my compiler doesn&#39;t know what main() is yet, so I just have to define it before using it. I wasn&#39;t calling it twice.[/b]



You were. I don&#39;t believe your program should compile cleanly (or perhaps even at all). Apart from having recursion in your program that would cause a stack overflow if used too much, you have an illegal definition of composite() - you have said it returns an integer value when it does not return anything. If this compiled, it would have surely made a warning.





> Also, I feel that if I copy a program, I might as well just download it. You misunderstood my intent with this program; it&#39;s to learn, not to create an uber omgI&#39;llfindthelargestprimenumberinzahworld program. Using someone else&#39;s code doesn&#39;t help you learn. I&#39;m not looking for the best way.[/b]



Uh. You can learn a lot from other people&#39;s code - I find learning by example one of the best ways to learn something. It&#39;s entirely possible to go it alone and end up making something that gets a value in 100 lines of code when there is a much more elegant solution available. I understand the point was to learn something by doing, here, and you&#39;ve done so, but your program does not run and would not compile.

A rundown of the problems:



```
#include &#60;iostream&#62;
using namespace std;

float x;
float y;
int z;

int main &#40;&#41;;

int composite &#40;&#41;
{
****cout &#60;&#60; &#34;&#092;nCOMPOSITE&#34;;
********main &#40;&#41;;
}

int main&#40;&#41;
{

****cout &#60;&#60; &#34;&#092;n&#092;n-PRIME-&#092;nEnter a number to determine if it is prime.&#092;n&#34;;
****cin &#62;&#62; x;
****
****if &#40; x &#60;= 0 && x &#33;= -1 &#41;
********composite &#40;&#41;;

****for &#40; z = 2; z &#60;= &#40; x / 2 &#41;; ++z &#41;
****{
********for &#40; y = 2; y &#60;= &#40; x / 2 &#41;; ++y &#41;
********{
************if &#40; z == &#40; x / y &#41; &#41;
****************composite &#40;&#41;;
********}

****}
****
****cout &#60;&#60; &#34;&#092;nPRIME&#34;;
****
****main &#40;&#41;;
}
```





```
#include &#60;iostream&#62;
using namespace std;
```


This is fine. Great, in fact, that you&#39;re using the STL.




```
float x;
float y;
int z;
```


Bad news: you&#39;re defining global variables. Most people would consider this the Antichrist, these should be defined in a more local scope - main() itself would be fine for is. Moving these declarations into main() would do you a better service. Because you declare them here they are not initialised which is another bad point and could cause your program to crash/be more insecure than it needs to be.




```
int composite &#40;&#41;
{
****cout &#60;&#60; &#34;&#092;nCOMPOSITE&#34;;
```


You say this function returns an int. It doesn&#39;t, a simple mistake, just add _return 0;_ if you want to use this function.




```
main&#40;&#41;;
}
```


Why are you calling main again? This will cause a stack overflow very quickly if your program is used too much, and you should *never* call main more than once (contrary to your insistence, you are calling it more than once). Your function should return 0; and then main should loop again. Else the call stack will grow and grow.

Then in main():



```
****main &#40;&#41;;
}
```


You call main () again when you should be looping it, causing the same problem and making your code nigh on impossible to follow.

So your code does not actually compile, although like we&#39;ve just gone over, some problems that don&#39;t cause compiler errors still cause your code to be very hard to follow. Compiling your program in VC gets me this:





> ------ Build started: Project: Prime, Configuration: Debug Win32 ------
> Compiling...
> main.cpp
> c:&#092;users&#092;admin&#092;projects&#092;prime&  #092;prime&#092;main.cpp(14) : error C4716: &#39;composite&#39; : must return a value
> c:&#092;users&#092;admin&#092;projects&#092;prime&  #092;prime&#092;main.cpp(38) : warning C4717: &#39;main&#39; : recursive on all control paths, *function will cause runtime stack overflow*
> Build log was saved at "file://c:&#092;Users&#092;Admin&#092;Projects&#092;Prime&  #092;Prime&#092;Debug&#092;BuildLog.htm"
> Prime - 1 error(s), 1 warning(s)
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
> [/b]



I think that more or less proves my point.

A better program using your code would look like this:




```
#include &#60;iostream&#62;
using namespace std;

int main&#40;&#41;
{
****float x = 0;
****float y = 0;
****int z = 0;

****/* Realise that &#39;done&#39; will never become true and that you will never actually end this program in this state because you
****** are using cin as the input instead of any other method. Win32 API would use WM_CLOSE messages for example, to set done
****** to true. Therefore the program will loop forever but it since it never calls any other functions it will never crash
****** or overflow. */
****bool done = false, composite = false;
****while &#40; &#33;done &#41;
****{
********cout &#60;&#60; &#34;&#092;n&#092;n-PRIME-&#092;nEnter a number to determine if it is prime.&#092;n&#34;;
********cin &#62;&#62; x;

********/* We don&#39;t know at the start. So it isn&#39;t. */
********composite = false;
****
********if &#40; x &#60;= 0 && x &#33;= -1 &#41;
********{
************cout &#60;&#60; &#34;Composite&#33;&#34;;
************composite = true;

************/* It&#39;s easy enough to break here. */
************continue;
********}

********for &#40; z = 2; z &#60;= &#40; x / 2 &#41;; ++z &#41;
********{
************for &#40; y = 2; y &#60;= &#40; x / 2 &#41;; ++y &#41;
************{
****************if &#40; z == &#40; x / y &#41; &#41;
****************{
********************cout &#60;&#60; &#34;Composite&#33;&#092;n&#34;;
********************composite = true;
********************break;
****************}

****************/* Horrible. The way the program is structured requires this. */
****************if &#40; composite &#41;
********************break;
************}

************/* Also horrific. Don&#39;t do this&#58; it&#39;s the only way to stop the program from spewing &#34;composite&#33;&#34; over and over
************** again the amount of times the condition is true. */
************if &#40; composite &#41;
****************break;
********}
****
********if &#40; &#33;composite &#41;
************cout &#60;&#60; &#34;&#092;nPrime&#33;&#34;;
****}
****
****/* &#39;0&#39; is the convention for &#34;success&#34; in C++ style programs. It probably does not matter here, but
****** we return it anyway. */
****return 0;
}
```


That works. You will notice:

1. I removed the composite() function. I didn&#39;t see the point on it in this case: it&#39;s called only twice and two cout statements could do just as fine. Encapsulating your code is important, but in this case was moot.
2. The code does not cause a stack overflow on runtime, which is important else the program would crash.
3. There is an ugly use of boolean in there to stop the program from spewing out the wrong message. It works, which is great, but the way the program was structured was kind of hard to do any other way (the continue keyword in C++ doesn&#39;t support continue all the way up the loop like PHP does). I didn&#39;t want to rewrite your entire program as you don&#39;t feel you&#39;d learn a lot from that hence the rather nasty looking solution of guard clauses.
4. It compiles.

Either way, that should help.

----------


## Demerzel

> If you _really_ want 1 line:
> 
> 
> 
> 
> ```
> int factorial&#40;int x&#41; {if &#40;x==1||x==0&#41; return 1; else return factorial&#40;x-1&#41;*x;}
> ```
> 
> ...



Wouldn&#39;t this work and be a bit less messy?



```
int factorial&#40;int x&#41; { &#40;x==1||x==0&#41; ? return 1 &#58; return factorial&#40;x-1&#41;*x;}
```

----------


## TweaK

I&#39;d like to add that even though you claim taking other people&#39;s code and perhaps editing it "does not teach you anything", but I must ask you to reconsider.

I&#39;ve learned PHP and C++ mostly through seeing other people&#39;s code and editing it. I&#39;ve learned how to do new stuff; I could always create (web-)applications with current knowledge, but only to some extent - I couldn&#39;t - and still can&#39;t - magically sense what functions are used where on a completely new topic, when creating new applications unrelated to anything I&#39;ve ever done before. Looking at other people&#39;s code is the solution here (either that, or tutorials, but I tend to learn more from looking at how other people do it than simply reading a tutorial).

----------


## M-Cat

> You were. I don&#39;t believe your program should compile cleanly (or perhaps even at all). Apart from having recursion in your program that would cause a stack overflow if used too much, you have an illegal definition of composite() - you have said it returns an integer value when it does not return anything. If this compiled, it would have surely made a warning.[/b]



Lol how come ive compiled it and it works then?

Try actually learning C before you criticize people, loser.

----------


## Demerzel

> Lol how come ive compiled it and it works then?
> 
> Try actually learning C before you criticize people, loser.
> [/b]



He&#39;s right. You&#39;re wrong. Read what he says and you might be up to a 3% chance of learning C yourself.

----------


## Kaniaz

> Lol how come ive compiled it and it works then?
> 
> Try actually learning C before you criticize people, loser.[/b]



Oh _grow up._ Your code was invalid and would be choked upon by a compiler, but I won&#39;t argue the point (not much debate can come up against those magic compilers). I&#39;m sorry if I spent all that time trying to help you write better code by basically detailing its life story. I won&#39;t expect to see much good coming from you until you change the attitude.

----------


## M-Cat

You are in denial. If you actually tried compiling it you would see it works  :smiley: . Apparently you do not wish to do that because you know I am right, you are wrong.

And what is wrong with using a perfectly respectable compiler? Just because yours might be crap doesn&#39;t mean other people can&#39;t use good ones  :tongue2: .

Owned kthxbai. I don&#39;t feel like coming back to this nerdy topic so I will leave you to wallow in your self-pity  :smiley:  I am too cool to be arguing about programming languages lol.

----------


## MSG

Okay so I&#39;m going to try and compile this motherfucker

----------


## TweaK

This is the funniest topic ever. Thanks M-Cat, even though you won&#39;t read this anymore, you&#39;ve made me laugh harder than I have in a long time.

----------


## MSG

Okay so it didn&#39;t compile in Visual C++ 2005 Express.

M-Cat, what compiler are you using? I really want to get your program to work.

----------


## Identity X

Only Java to a sufficient degree of faith.

Also: Python, Visual Basic, PHP, SQL, QBasic (first language I knew, great it was too), MIPS, NetLogo, BBC BASIC, some C, enough C#.

----------


## Pyrofan1

> Lol how come ive compiled it and it works then?
> [/b]



Because your compiler is not an ANSI C compiler

----------


## dsr

> Wouldn&#39;t this work and be a bit less messy?
> 
> 
> 
> ```
> int factorial&#40;int x&#41; { &#40;x==1||x==0&#41; ? return 1 &#58; return factorial&#40;x-1&#41;*x;}
> ```
> 
> 
> [/b]



Good point. I&#39;m used to Python in which there is no real ternary (although you can fake it and Python 2.5 introduced a pseudo-ternary operator iirc).

M-Cat, for your prime number checker, you could always compute an array of prime numbers up to the given integer and check to see if the array contains the integer. While this might not yield the best performance, it would test your ability to implement algorithms in C/C++. Here&#39;s an example of the sieve of Eratosthenes (an inefficient but easy-to-understand algorithm for computing a list of primes) in Python:




```
def primes&#40;n&#41;&#58;
****A, B = range&#40;2, n+1&#41;, &#91;&#93;
****while A&#58;
********B.append&#40;A&#91;0&#93;&#41;
********A = &#91;x for x in A if x % B&#91;-1&#93; &#33;= 0&#93;
****return B
```


I once implemented that algorithm in Python. Then I tried to port it to C++ and was astonished how much more code had to be written. Python is amazingly productive.

----------


## Kaniaz

> sieve of Eratosthenes[/b]



That&#39;s the name.

----------


## dsr

Indeed it is.  ::bigteeth::  The Sieve of Atkin yields faster performance, but it is a little more complicated and I didn&#39;t feel like explaining it. I&#39;m sure there&#39;s a Wikipedia article detailing it.

Edit: As much as I wanted to avoid chiming in, I feel compelled to do so. M-Cat, Kaniaz spent a half hour to an hour trying to teach you how not to code, and you are refusing to listen to him. You&#39;re the one who needs to learn the language. By the way, the language in question is C++ and not C. ANSI C doesn&#39;t have iostream nor does it have the STL. Oh and I hate to say this, but although Kaniaz&#39;s advice is correct, M-Cat&#39;s original code _does_ compile somehow in GCC (g++), which is the de facto standard compiler. Go figure.

----------


## QwinsepiaSquared

Eh, I&#39;m confuzzled.

I can do very basic stuff with HTML...pretty much just make a link like this:

<a href=www.dreamviews.com>This</a>

But then again, I&#39;ve picked up basically everything I know by fixing my friends&#39; broken myspace codes. XD

----------


## TweaK

> Edit: As much as I wanted to avoid chiming in, I feel compelled to do so. M-Cat, Kaniaz spent a half hour to an hour trying to teach you how not to code, and you are refusing to listen to him. You&#39;re the one who needs to learn the language. By the way, the language in question is C++ and not C. ANSI C doesn&#39;t have iostream nor does it have the STL. Oh and I hate to say this, but although Kaniaz&#39;s advice is correct, M-Cat&#39;s original code _does_ compile somehow in GCC (g++), which is the de facto standard compiler. Go figure.
> [/b]



Dude, _respect++_.





> Eh, I&#39;m confuzzled.
> 
> I can do very basic stuff with HTML...pretty much just make a link like this:
> 
> <a href=www.dreamviews.com>This</a>
> 
> But then again, I&#39;ve picked up basically everything I know by fixing my friends&#39; broken myspace codes. XD
> [/b]



And in fact, even _that_ is wrong  :wink2:  You always have to include http:// with <a> tags, or it will link to a directory named www.dreamviews.com. Let&#39;s say we&#39;re on a page named Link.html, in http://www.oursite.com/Content/Menu/Link.html, and we insert your code, we&#39;d link to http://www.oursite.com/Content/Menu/wwww.dreamviews.com  :smiley:  If we add http, we actually link to Dreamviews.

----------


## arby

Should we re-name this to the programming language war thread? XD

----------


## TweaK

Nah, it simply derailed, but it&#39;s back.. Sorta.

----------


## Jeremysr

The ones that I know really well are PHP, QBasic, Lua. I&#39;m learning C and LISP.

(I know XHTML and CSS too...)

----------


## Ne-yo

I have used DrPython for a while now and really like it&#33; Comes in Windows and Linux versions. It has clean displays and a minimum of quirks (does not like foreign characters). There are lots of configuration options. The results are displayed in an output window, and you can select and copy items from there. You can also install the code completion plugin from the internet from within the DrPython.

I have used HapDebugger, Boa, PyScripter, IDLE and PythonWin, I&#39;ve even used SPE for quite a while. No, it&#39;s not the "Society of Petroleum Engineers", but "Stani&#39;s Python Editor". For some odd reason it has vanished on the net. I always come back to DrPython. I also use a more general editor/IDE called ConText. That one allows me to run C code and Python code in parallel.

----------


## Artelis

Aiite, so when I was in fourth grade I used this scripting language called, uhm, frog?  I don&#39;t remember, but it was used to control a little something.  A frog I think.  Anyway, my teacher CALLED it a programming language.  Can I add that to my list?  Probably not.

C, C++, Visual C++ (ew)
Visual Basic, QBasic, and Basic - Oh my&#33;
Python, Perl, PHP - All with MySQL happiness.

Keep in mind I haven&#39;t really programmed since my junior year in college (3 years ago) so there&#39;s a good chance that I&#39;m really bad at most of these now.  We determined that last night  :wink2:

----------

