C++, Na'vi style

Started by Irtaviš Ačankif, April 02, 2012, 09:17:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Irtaviš Ačankif

#include <iostream>
#include <stdio.h>

sar tstxotseng std;

hlpx fiponatsiSkxawng(hlpx i)
{
   txo(i < 2)
   {
      tng i;
   }
   tkfyw
   {
      //plltxe("holpxay lu ");plltxe("fiponatsi ta %d", i-1);plltxe(" sì ");plltxe("fiponatsi ta %d", i-2);plltxe("\n");
      tng(fiponatsiSkxawng(i-1) + fiponatsiSkxawng(i-2));
   }
}

hlpx fiponatsiKanu(hlpx z)
{
   hlpx i = 0;
   hlpx tor = 1;
   hlpx trhy = 1;
   hlpx r = 1;
   tengkrr(i < z - 2)
   {
      r = tor + trhy;
      //plltxe("holpxay lu ");plltxe("%d", tor);plltxe(" sì ");plltxe("%d", trhy);plltxe("\n");
      trhy = tor;
      tor = r;
      i++;
   }
   tng r;
}

hlpx main(hlpx argc, lvi *argv[])
{
   srake skxawng;
   pamrel d;
   wrrpa << "Srake sivar fya'o leskxawng? ";
   cin >> d;
   txo(d=="srane") skxawng = srane;
   tkfyw skxawng = kehe;
   sng:
   wrrpa << "Pamrel sivi ngeyä holpxayur: ";
   hlpx t;
   cin >> t;
   txo(t>46) kn sng;
   txo(skxawng) wrrpa << fiponatsiSkxawng(t) << endl;
   tkfyw wrrpa << fiponatsiKanu(t) << endl;
   kn sng;
   tng 0;
}


Si-nì'ul-nì'ul oeru lu sunu nìtxan!  ;)
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

Sìkat

#1
HRH! As a programmer, I definitely like this ;D

And yes, I built & ran it :)


Irtaviš Ačankif

C# though doesn't have a preprocessor which can do useful things like this  ;D
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

Tsmuktengan

This rather looks more like C than C++ (except some parts of the syntax).... but looks nice... except I don't get anything.  ;D


Irtaviš Ačankif

It is compilable by gcc as cpp, not c. Try it!
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

Tsmuktengan

Quote from: Uniltìrantokx te Skxawng on April 04, 2012, 11:19:58 PM
It is compilable by gcc as cpp, not c. Try it!

I know, but this is an iterative paradigm, used in C, while C++ is object orientated and therefore usually has a different programing style. And stdio.h is a C header, not a C++ library. But all that's not important.  ;)


Irtaviš Ačankif

Haha that is exactly the way I usually write C++. Perhaps you can call it "C+" :). Anyway, IOSTREAM is also included, showing that it is C++.

Except when I need to manage complex GUI applications I usually don't go through the hassle of defining objects and using OO programming. Even in C#, which is arguably even more object-oriented than C++ (there is no such thing as pointers!), out of GUI programs or programs requiring fancy threading/timing things I stay away from objects. They are hard to debug compared to simple loops  ;D
Previously Ithisa Kīranem, Uniltìrantokx te Skxawng.

Name from my Sakaš conlang, from Sakasul Ältäbisäl Acarankïp

"First name" is Ačankif, not Eltabiš! In Na'vi, Atsankip.

`Eylan Ayfalulukanä

I laughed 'till I hurt! It was the best 'humor' I have had in days!

Wherever did you come up with a prerpocessor (or whatever) that changes the commands into Na'vi?

Yawey ngahu!
pamrel si ro [email protected]

Sìkat

It's an inherent part of the language.

Human No More

I was thinking about something like this a while ago... it's easy enough to do in C and related languages compared to most since you don't actually need to change anything within the compiler.

Nice though ;D
"I can barely remember my old life. I don't know who I am any more."

HNM, not 'Human' :)

Na'vi tattoo:
1 | 2 (finished) | 3
ToS: Human No More
dA
Personal site coming soon(ish

"God was invented to explain mystery. God is always invented to explain those things that you do not understand."
- Richard P. Feynman