Initial commit: Oraset3 programming language with OS-level features
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// Generated by Oraset3 Compiler
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int factorial(int n);
|
||||
void printFibonacci(int n);
|
||||
int main();
|
||||
void printString(string value);
|
||||
void printInt(int value);
|
||||
|
||||
int factorial(int n) {
|
||||
if ((n <= 1) ) {
|
||||
return 1 ;
|
||||
}
|
||||
return (n * factorial((n - 1))) ;
|
||||
}
|
||||
|
||||
void printFibonacci(int n) {
|
||||
int a = 0 ;
|
||||
int b = 1 ;
|
||||
int i = 0 ;
|
||||
int temp = 0 ;
|
||||
while ((i < n) ) {
|
||||
printInt(a) ;
|
||||
temp = b ;
|
||||
b = (a + b) ;
|
||||
a = temp ;
|
||||
i = (i + 1) ;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
string message = "Hello, Oraset3!" ;
|
||||
printString(message) ;
|
||||
int num = 5 ;
|
||||
int result = factorial(num) ;
|
||||
printString("Factorial of 5 is:") ;
|
||||
printInt(result) ;
|
||||
printString("Fibonacci sequence:") ;
|
||||
printFibonacci(10) ;
|
||||
}
|
||||
|
||||
void printString(string value) {
|
||||
((std::cout << value) << std::endl) ;
|
||||
}
|
||||
|
||||
void printInt(int value) {
|
||||
((std::cout << value) << std::endl) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user