R Unlimited CZ Forum Index
Donate $5 to get admin level 5 ->    
R Unlimited CZ
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  Usergroups
Register  ::  Log in Log in to check your private messages


Post new topic  Reply to topic Goto page 1, 2, 3  Next
 C++/C/Pascal/basic/etc... « View previous topic :: View next topic » 
Author Message
Lanac
PostPosted: Thu Oct 20, 2011 2:48 pm    Post subject: C++/C/Pascal/basic/etc... Reply with quote

Tyrant
Tyrant

Joined: 10 Sep 2010
Posts: 865
Location: Idk...

So, I took programming in my school(it was an option, wasnt needed), I started learning c++, and im failing hard on simplest tasks since i dont under stand some things, which is probably happening becouse my lack of concentration. I know the commands, but i cant put what is needed in task in the command, so I am asking is anyone willing of helping me via text, skype or whatever?
_________________
My Youtube Channel:
Please help my ass and click on link, im a poor bitch...(+ ill make some trem videos too Very Happy)
http://adf.ly/2qaKp
Back to top
View user's profile Send private message Send e-mail
pmd
PostPosted: Thu Oct 20, 2011 4:28 pm    Post subject: Reply with quote

Server supporter
Server supporter

Joined: 16 May 2010
Posts: 268
Location: Novorossiysk city, Russian Federation

c++ are sophisticated. especially pure. the acrobatics with strings are so epic.
_________________
[quote="Quarko"] If you have time to think about crap - you are not working hard enough.[/quote]
Back to top
View user's profile Send private message
Redman
PostPosted: Thu Oct 20, 2011 4:54 pm    Post subject: Reply with quote

Marauder
Marauder

Joined: 03 Apr 2009
Posts: 403
Location: Walbrzych, Poland

pmd wrote:
c++ are sophisticated. especially pure. the acrobatics with strings are so epic.


What? C / C++ is very easy. Here's an example:
Code:
#include <ncurses.h>/*****************************************************/
            int               m[256                   ] [         256   ],a
 ,b   ;;;   ;;;   WINDOW*w;   char*l=""   "\176qxl"   "q"   "q"   "k"   "w\
xm"   "x"   "t"         "j"         "v"         "u"         "n"         ,Q[
 ]=   "Z"   "pt!ftd`"   "qdc!`eu"   "dq!$c!nnwf"/**   ***   */"t\040\t";c(
int   u ,         int         v){                     v?m   [u]         [v-
 1]   |=2,m[u][v-1] &   48?W][v-1   ] &   15]]):0:0;u?m[u   -1][v]|=1   ,m[
 u-               1][   v]&         48?               W-1   ][v         ]&
15]   ]):0:0;v<   255   ?m[   u][v+1]|=8,m[u][v+1]&   48?   W][   v+1]&15]]
):0         :0;         u <               255   ?m[   u+1         ][v   ]|=
4,m[u+1][   v]&48?W+1][v]&15]]):0:0;W][   v]&   15]   ]);}cu(char*q){   return
 *q               ?cu   (q+         1)&         1?q   [0]               ++:
q[0   ]--   :1;   }d(   int   u ,   int/**/v,   int/**/x,   int   y){   int
Y=y   -v,   X=x         -u;   int         S,s   ;Y<         0?Y   =-Y   ,s,
s=-   1:(   s=1);X<0?X=-X,S   =-1  :(S=   1);   Y<<=   1;X<<=1;   if(X>Y){
int   f=Y               -(X   >>1   );;               while(u!=         x){
f>=   0?v+=s,f-=X:0;u   +=S   ;f+=   Y;m[u][v]|=32;mvwaddch(w,v   ,u,   m[u
 ][               v]&   64?   60:         46)         ;if         (m[   u][
v]&16){c(u,v);;   ;;;   ;;;   return;}}   }else{int   f=X   -(Y>>1);;   while
 (v   !=y         ){f   >=0         ?u   +=S,               f-=         Y:0
 ;v   +=s   ;f+=X;m[u][v]|=   32;mvwaddch(w,v   ,u,m[u][v]&64?60:46);if(m[u
 ][                     v]&         16)   {c(   u,v                     );
  ;   return;;;}}}}Z(   int/**/a,   int   b){   }e(   int/**/y,int/**/  x){
int               i ;         for         (i=         a;i               <=a
+S;i++)d(y,x,i,b),d(y,x,i,b+L);for(i=b;i<=b+L;i++)d(y,x,a,i),d(y,x,a+   S,i
 );                     ;;;         ;;;         ;;;               ;;;   ;
  mvwaddch(w,x,y,64);   ;;;   ;;;   ;;;   prefresh(   w,b,a,0,0   ,L-   1,S-1
);}             main(         int               V ,   char              *C[
  ]   ){FILE*f=   fopen(V==1?"arachnid.c"/**/   :C[   1],"r");int/**/x,y,c,
v=0         ;;;      initscr              ();               Z(Z         (raw
 ()   ,Z(   curs_set(0),Z(1   ,noecho()))),keypad(    stdscr,TRUE));w   =newpad
  (   300,  300               ) ;   for         (x=   255   ; x   >=0   ;x--
  )   for   (y=   255   ;y>=0;y--   )m[   x][   y]=   0;x=y=0;refresh( );while
  (   (c=                           fgetc (f)   )+1)                    {if(
0||c==10||  x==   256){x=0;y++;if(y==256  )break;;}   else{m[x][y]=(c   ==
'~'   ?64   : c   ==32              ?0:         16)   ;;x               ++;
      }}for(x=0   ;x<   256;x++)m   [x][0]=16   ,m[   x][   255]=16;for(y=0
;y<         256   ; y         ++)   m[0         ][y   ] =               16,
m[255][y]   =16   ;a=b=c=0;   x=y   =1;   do{v++;mvwaddch   (w,   y,x   ,m[
x][         y]&               32?   m[x                     ][y   ] &   16?
 0|   acs_map[l[m[x][y]&15]]:46 :   32);c==0163&&!(m[x][y+1]&16)?y++:   0;c
 ==   119         &&!         (m[                                       x][
 y-   1]&   16)   ?y--:0;;c   ==97  &&!(m[x-1][y]&16)?x--:0;c==100&&!(m[x+1
 ][   y]&   16)         ? x   ++:0              ;if(                    c==
 3-   1+1   ){endwin(   );;   return(0)   ;}x   -a<5?a>S-   5?a-=S-5:(a=0):
0;x               -a>         S-5?a<255   -S*         2?a               +=S
-5:(a=256-S):0;   y-b<5?b>L-5?b-=L-5:(b   =0)   :0;   y-b>L-5?b<255-L   *2?
b+=                                       L-5   :(b                     =256
-L)   :0;e(x,y);if(m[x][y]&64)break;}while((c=getch())!=-1);endwin();cu(Q);
printf(Q,v);}
Back to top
View user's profile Send private message
Quarko
PostPosted: Thu Oct 20, 2011 5:18 pm    Post subject: Reply with quote

Server supporter
Server supporter

Joined: 22 May 2009
Posts: 1227
Location: Kaunas, Lithuania

Lanac, do not worry, Redman is noob and added lots of trash into that code like ";;;" and similiar stuff. If that code is cleaned up, it looks very pretty and readable:

Code:
#include<ncurses>/*****************************************************/
int m[256][256],a,b;WINDOW*w;char*l="" "\176qxl" "q" "q" "k" "w\ xm" "x"
"t" "j" "v" "u" "n",Q[]="Z" "pt!ftd`" "qdc!`eu" "dq!$c!nnwf"/******/
"t\040\t";c(int u,int v){v?m[u][v-1]|=2,m[u][v-1]&48?W][v-1]&15]]):0:0;
u?m[u-1][v]|=1,m[u-1][v]&48?W-1][v]&15]]):0:0;v<255?m[u][v+1]|=8,m[u][v+1]
&48?W][v+1]&15]]):0:0;u<255?m[u+1][v]|=4,m[u+1][v]&48?W+1][v]&15]]):0:0;W]
[v]&15]]);}cu(char*q){return*q?cu(q+1)&1?q[0]++:q[0]--:1;}d(int u,int/**/v,
int/**/x,int y){int Y=y-v,X=x-u;int S,s;Y<0?Y=-Y,s,s=-1:(s=1);X<0?X=-X,S=-1
:(S=1);Y<<=1;X<<1>Y){int f=Y-(X>>1);while(u!=x){f>=0?v+=s,f-=X:0;u+=S;
f+=Y;m[u][v]|=32;mvwaddch(w,v,u,m[u][v]&64?60:46);if(m[u][v]&16){c(u,v);
return;}}}else{int f=X-(Y>>1);while(v !=y){f>=0?u+=S,f-=Y:0;v+=s;f+=X;m[u]
[v]|=32;mvwaddch(w,v,u,m[u][v]&64?60:46);if(m[u][v]&16){c(u,v);return;}}}}
Z(int/**/a,int b){}e(int/**/y,int/**/x){int i;for(i=a;i<=a+S;i++)d(y,x,i,b)
,d(y,x,i,b+L);for(i=b;i<b>=0;
x--)for(y=255;y>=0;y--)m[x][y]=0;x=y=0;refresh();while((c=fgetc(f))+1){if
(0||c==10||x==256){x=0;y++;if(y==256)break;}else{m[x][y]=(c=='~'?64:c==32?
0:16);x++;}}for(x=0;x<256;x++)m[x][0]=16,m[x][255]=16;for(y=0;y<256;y++)m
[0][y]=16,m[255][y]=16;a=b=c=0;x=y=1;do{v++;mvwaddch(w,y,x,m[x][y]&32?m[x]
[y]&16?0|acs_map[l[m[x][y]&15]]:46:32);c==0163&&!(m[x][y+1]&16)?y++:0;
c==119&&!(m[x][y-1]&16)?y--:0;c==97&&!(m[x-1][y]&16)?x--:0;c==100&&!(m[x+1]
[y]&16)?x++:0;if(c==3-1+1){endwin();return(0);}x-a<5>S-5?a-=S-5:(a=0):0;
x-a>S-5?a<255-S*2?a+=S-5:(a=256-S):0;y-b<5>L-5?b-=L-5:(b=0):0;y-b>L-5?
b<255-L*2?b+=L-5:(b=256-L):0;e(x,y);if(m[x][y]&64)break;}while((c=getch())
!=-1);endwin();cu(Q);printf(Q,v);}
Back to top
View user's profile Send private message
Lanac
PostPosted: Thu Oct 20, 2011 5:24 pm    Post subject: Reply with quote

Tyrant
Tyrant

Joined: 10 Sep 2010
Posts: 865
Location: Idk...

*sigh* cmon guys, srssly, i wanna learn it like a boss ^^, but i dont get the hang off it i just suck at it. I really would apritiate any kind of help, sinc eredmans post was...
No comment.
_________________
My Youtube Channel:
Please help my ass and click on link, im a poor bitch...(+ ill make some trem videos too Very Happy)
http://adf.ly/2qaKp
Back to top
View user's profile Send private message Send e-mail
Nod_Nod_Nod
PostPosted: Thu Oct 20, 2011 5:35 pm    Post subject: Reply with quote

Tyrant
Tyrant

Joined: 14 Mar 2010
Posts: 1079
Location: Poland

Start with cout << "Hi world";

Its helping

MUAHAHHAHA
_________________
The nodding of the head once to symbolize a greeting, cuz we white folk to damn lazy to open our mouths and speak up. Nods are also easier to shake off than a flase "hello".
"Person nods at you", or your direction, "you nod back"
Back to top
View user's profile Send private message Visit poster's website
grmg.pl
PostPosted: Thu Oct 20, 2011 5:37 pm    Post subject: Reply with quote

Marauder
Marauder

Joined: 06 Feb 2011
Posts: 514

Quarko wrote:
Code:
#include<ncurses>/*****************************************************/
int m[256][256],a,b;WINDOW*w;char*l="" "\176qxl" "q" "q" "k" "w\ xm" "x"
"t" "j" "v" "u" "n",Q[]="Z" "pt!ftd`" "qdc!`eu" "dq!$c!nnwf"/******/
"t\040\t";c(int u,int v){v?m[u][v-1]|=2,m[u][v-1]&48?W][v-1]&15]]):0:0;
u?m[u-1][v]|=1,m[u-1][v]&48?W-1][v]&15]]):0:0;v<255?m[u][v+1]|=8,m[u][v+1]
&48?W][v+1]&15]]):0:0;u<255?m[u+1][v]|=4,m[u+1][v]&48?W+1][v]&15]]):0:0;W]
[v]&15]]);}cu(char*q){return*q?cu(q+1)&1?q[0]++:q[0]--:1;}d(int u,int/**/v,
int/**/x,int y){int Y=y-v,X=x-u;int S,s;Y<0?Y=-Y,s,s=-1:(s=1);X<0?X=-X,S=-1
:(S=1);Y<<=1;X<<1>Y){int f=Y-(X>>1);while(u!=x){f>=0?v+=s,f-=X:0;u+=S;
f+=Y;m[u][v]|=32;mvwaddch(w,v,u,m[u][v]&64?60:46);if(m[u][v]&16){c(u,v);
return;}}}else{int f=X-(Y>>1);while(v !=y){f>=0?u+=S,f-=Y:0;v+=s;f+=X;m[u]
[v]|=32;mvwaddch(w,v,u,m[u][v]&64?60:46);if(m[u][v]&16){c(u,v);return;}}}}
Z(int/**/a,int b){}e(int/**/y,int/**/x){int i;for(i=a;i<=a+S;i++)d(y,x,i,b)
,d(y,x,i,b+L);for(i=b;i<b>=0;
x--)for(y=255;y>=0;y--)m[x][y]=0;x=y=0;refresh();while((c=fgetc(f))+1){if
(0||c==10||x==256){x=0;y++;if(y==256)break;}else{m[x][y]=(c=='~'?64:c==32?
0:16);x++;}}for(x=0;x<256;x++)m[x][0]=16,m[x][255]=16;for(y=0;y<256;y++)m
[0][y]=16,m[255][y]=16;a=b=c=0;x=y=1;do{v++;mvwaddch(w,y,x,m[x][y]&32?m[x]
[y]&16?0|acs_map[l[m[x][y]&15]]:46:32);c==0163&&!(m[x][y+1]&16)?y++:0;
c==119&&!(m[x][y-1]&16)?y--:0;c==97&&!(m[x-1][y]&16)?x--:0;c==100&&!(m[x+1]
[y]&16)?x++:0;if(c==3-1+1){endwin();return(0);}x-a<5>S-5?a-=S-5:(a=0):0;
x-a>S-5?a<255-S*2?a+=S-5:(a=256-S):0;y-b<5>L-5?b-=L-5:(b=0):0;y-b>L-5?
b<255-L*2?b+=L-5:(b=256-L):0;e(x,y);if(m[x][y]&64)break;}while((c=getch())
!=-1);endwin();cu(Q);printf(Q,v);}



What does that code do?
Back to top
View user's profile Send private message
Redman
PostPosted: Thu Oct 20, 2011 5:39 pm    Post subject: Reply with quote

Marauder
Marauder

Joined: 03 Apr 2009
Posts: 403
Location: Walbrzych, Poland

If you want help then ask more specific questions here (like "how can i concatenate two strings", not "plz help").

@edit
Quote:
What does that code do?

No idea. I was just looking for some simple C program on the internet and found this.
Back to top
View user's profile Send private message
Lanac
PostPosted: Thu Oct 20, 2011 6:01 pm    Post subject: Reply with quote

Tyrant
Tyrant

Joined: 10 Sep 2010
Posts: 865
Location: Idk...

Actually, plz help is the thing iwanted to say, since i dont even know the names of things, only know variable...
_________________
My Youtube Channel:
Please help my ass and click on link, im a poor bitch...(+ ill make some trem videos too Very Happy)
http://adf.ly/2qaKp
Back to top
View user's profile Send private message Send e-mail
grmg.pl
PostPosted: Thu Oct 20, 2011 8:09 pm    Post subject: Reply with quote

Marauder
Marauder

Joined: 06 Feb 2011
Posts: 514

The special, highly complicated programmer tool known as Google made an output from "free online c++ course" input:


http://www.cplusplus.com/doc/tutorial/
http://www.macs.hw.ac.uk/~rjp/Coursewww/


Not to mention a shitload of hmm... "free" materials that u can umm... "obtain" from the uhh... "different search engines".
Back to top
View user's profile Send private message
Rotacak
PostPosted: Thu Oct 20, 2011 8:38 pm    Post subject: Reply with quote

Tyrant
Tyrant

Joined: 17 Sep 2007
Posts: 1388
Location: Czech Republic

Lanac: you should give it up now, before you waste more time.
_________________
Rotaxmame games | Hry zdarma
Back to top
View user's profile Send private message Send e-mail
PPNL
PostPosted: Thu Oct 20, 2011 10:40 pm    Post subject: Reply with quote

Server supporter
Server supporter

Joined: 02 May 2010
Posts: 625
Location: The Netherlands

TADAA cleaned it up for you Lanac.

Code:
#include <ncurses> /*****************************************************/
int m[256][256], a, b;
WINDOW * w;
char * l = """\176qxl""q""q""k""w\ xm""x""t""j""v""u""n", Q[] = "Z""pt!ftd`""qdc!`eu""dq!$c!nnwf" /******/
"t\040\t";
c(int u, int v) {
    v ? m[u][v - 1] |= 2, m[u][v - 1] & 48 ? W][v - 1] & 15]]): 0: 0;
u ? m[u - 1][v] |= 1, m[u - 1][v] & 48 ? W - 1][v] & 15]]) : 0 : 0;
v < 255 ? m[u][v + 1] |= 8, m[u][v + 1] & 48 ? W][v + 1] & 15]]) : 0 : 0;
u < 255 ? m[u + 1][v] |= 4, m[u + 1][v] & 48 ? W + 1][v] & 15]]) : 0 : 0;
W][v] & 15]]);
}
cu(char * q) {
    return *q ? cu(q + 1) & 1 ? q[0]++ : q[0]-- : 1;
}
d(int u, int /**/ v, int /**/ x, int y) {
    int Y = y - v, X = x - u;
    int S, s;
    Y < 0 ? Y = -Y, s, s = -1 : (s = 1);
    X < 0 ? X = -X, S = -1 : (S = 1);
    Y <<= 1;
    X <<1> Y) {
    int f = Y - (X >> 1);
    while (u != x) {
        f >= 0 ? v += s, f -= X : 0;
        u += S;
        f += Y;
        m[u][v] |= 32;
        mvwaddch(w, v, u, m[u][v] & 64 ? 60 : 46);
        if (m[u][v] & 16) {
            c(u, v);
            return;
        }
    }
} else {
    int f = X - (Y >> 1);
    while (v != y) {
        f >= 0 ? u += S, f -= Y : 0;
        v += s;
        f += X;
        m[u][v] |= 32;
        mvwaddch(w, v, u, m[u][v] & 64 ? 60 : 46);
        if (m[u][v] & 16) {
            c(u, v);
            return;
        }
    }
}
}
Z(int /**/ a, int b) {}
e(int /**/ y, int /**/ x) {
    int i;
    for (i = a; i <= a + S; i++) d(y, x, i, b), d(y, x, i, b + L);
    for (i = b; i <b>= 0;
    x--) for (y = 255; y >= 0; y--) m[x][y] = 0;
    x = y = 0;
    refresh();
    while ((c = fgetc(f)) + 1) {
        if (0 || c == 10 || x == 256) {
            x = 0;
            y++;
            if (y == 256) break;
        } else {
            m[x][y] = (c == '~' ? 64 : c == 32 ? 0 : 16);
            x++;
        }
    }
    for (x = 0; x < 256; x++) m[x][0] = 16, m[x][255] = 16;
    for (y = 0; y < 256; y++) m[0][y] = 16, m[255][y] = 16;
    a = b = c = 0;
    x = y = 1;
    do {
        v++;
        mvwaddch(w, y, x, m[x][y] & 32 ? m[x][y] & 16 ? 0 | acs_map[l[m[x][y] & 15]] : 46 : 32);
        c == 0163 && !(m[x][y + 1] & 16) ? y++ : 0;
        c == 119 && !(m[x][y - 1] & 16) ? y-- : 0;
        c == 97 && !(m[x - 1][y] & 16) ? x-- : 0;
        c == 100 && !(m[x + 1][y] & 16) ? x++ : 0;
        if (c == 3 - 1 + 1) {
            endwin();
            return (0);
        }
        x - a <5> S - 5 ? a -= S - 5 : (a = 0): 0;
        x - a > S - 5 ? a < 255 - S * 2 ? a += S - 5 : (a = 256 - S) : 0;
        y - b <5> L - 5 ? b -= L - 5 : (b = 0): 0;
        y - b > L - 5 ? b < 255 - L * 2 ? b += L - 5 : (b = 256 - L) : 0;
        e(x, y);
        if (m[x][y] & 64) break;
    }
    while ((c = getch()) != -1);
    endwin();
    cu(Q);
    printf(Q, v);
}

_________________
I Maul Ya
McDretch
McRauder
*PPNL MAULED **
*PPNL ZaPP ZaPP
Sky Mauler
O_o
Back to top
View user's profile Send private message
PPNL
PostPosted: Thu Oct 20, 2011 10:41 pm    Post subject: Reply with quote

Server supporter
Server supporter

Joined: 02 May 2010
Posts: 625
Location: The Netherlands

Rotacak wrote:
Lanac: you should give it up now, before you waste more time.


Rotacak, peoples want to learn, Lanac wants to learn, let him do that, don't let him give up -,-, it's a bad advice from a big owna of a big serva
_________________
I Maul Ya
McDretch
McRauder
*PPNL MAULED **
*PPNL ZaPP ZaPP
Sky Mauler
O_o
Back to top
View user's profile Send private message
Quarko
PostPosted: Fri Oct 21, 2011 4:38 am    Post subject: Reply with quote

Server supporter
Server supporter

Joined: 22 May 2009
Posts: 1227
Location: Kaunas, Lithuania

PPNL wrote:
Rotacak wrote:
Lanac: you should give it up now, before you waste more time.


Rotacak, peoples want to learn, Lanac wants to learn, let him do that, don't let him give up -,-, it's a bad advice from a big owna of a big serva


Actually I agree with Rotacak on this one. If he really wanted to learn - he'd take google and learn it. There is no shortcuts, you just have to practice. Instead, Lanac is spamming this forum with requests to help him learn it...
Back to top
View user's profile Send private message
Castyo
PostPosted: Fri Oct 21, 2011 9:02 am    Post subject: Reply with quote

Dretch
Dretch

Joined: 27 Sep 2007
Posts: 98
Location: Italy

Quarko wrote:
PPNL wrote:
Rotacak wrote:
Lanac: you should give it up now, before you waste more time.


Rotacak, peoples want to learn, Lanac wants to learn, let him do that, don't let him give up -,-, it's a bad advice from a big owna of a big serva


Actually I agree with Rotacak on this one. If he really wanted to learn - he'd take google and learn it. There is no shortcuts, you just have to practice. Instead, Lanac is spamming this forum with requests to help him learn it...


Non vitae, sed scholae discimus.
Seneca
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3  Next Page 1 of 3

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


DAJ Glass (1.0.8) template by Dustin Baccetti
EQ graphic based off of a design from www.freeclipart.nu
Powered by phpBB © 2001, 2005 phpBB Group