initial
This commit is contained in:
commit
74ae93a96e
1 changed files with 94691 additions and 0 deletions
|
|
@ -0,0 +1,91 @@
|
|||
cli commands for different programming languages
|
||||
- C
|
||||
Requiments : gcc in linux and mingw in windows
|
||||
For build system : meson, cmake,pkg-config
|
||||
configuration file : Makefile
|
||||
```c
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
// printf() displays the string inside quotation
|
||||
printf("Hello, World!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
||||
- Compiling and running
|
||||
`gcc hello.c -o hello`
|
||||
Additionally to link packages use
|
||||
```
|
||||
gcc `pkg-config --cflags gtk+-3.0` -o main1 main.c `pkg-config --libs gtk+-3.0`
|
||||
```
|
||||
this will compile and create a binary file named `hello`
|
||||
Running it
|
||||
`./hello`
|
||||
|
||||
- C++
|
||||
```cpp
|
||||
// Your First C++ Program
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
||||
- compiling and running
|
||||
`g++ hello.cpp -o hello` and `./hello` to run
|
||||
Additionally to link packages
|
||||
`g++ main.cpp -Ifltk-1.3.9 -Lfltk-1.3.9/lib -lfltk -lX11 -lXfixes -lXext -lXft -lXrender -lfontconfig -lXcursor -lXinerama -ldl -o main`
|
||||
|
||||
- Java
|
||||
Requirements : openjdk installed
|
||||
Build systems : maven/gradle(optional) for extra packages
|
||||
Config files : pom.xml for maven and build.gradle for gradle
|
||||
```java
|
||||
// Your First Program
|
||||
|
||||
class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, World!");
|
||||
}
|
||||
}
|
||||
```
|
||||
Compiling and running it
|
||||
`javac hello` this will create a bytecode named `HelloWorld.class`
|
||||
to execute the bytecode `java HelloWorld`
|
||||
Theory
|
||||
bytecode is the low level, platform independent code and when we use java command for bytecode it executes in JVM(Java Virtual Machine). This JVM converts bytecode into machine language and then executes it
|
||||
|
||||
Compiling and running with maven
|
||||
`mvn package` to build it
|
||||
`mvn spring-boot:run` to run the sprint boot app
|
||||
|
||||
- Javascript
|
||||
Requirements : node installed
|
||||
Build systems : npm/yarn for managing packages
|
||||
Config files : package.json
|
||||
```js
|
||||
console.log('Hello World!')
|
||||
```
|
||||
Running
|
||||
`node hello.js`
|
||||
for packages
|
||||
`npm i`
|
||||
`npm start`
|
||||
|
||||
- python
|
||||
Requirements : python 3.x installed
|
||||
Build system : pip for managing packages
|
||||
Config file : requirements.txt
|
||||
```py
|
||||
print("Hello World!")
|
||||
```
|
||||
Running
|
||||
`python hello.py`
|
||||
for packages
|
||||
`pip install requiremnts.txt`
|
||||
`python main.py`
|
||||
|
||||
|
||||
Loading…
Reference in a new issue