C++/C/Pascal/basic/etc...

Post anything else

Moderator: Nod_Nod_Nod

Message
Author
User avatar
Redman
Marauder
Marauder
Posts: 403
Joined: Fri Apr 03, 2009 6:00 pm
Location: Walbrzych, Poland

#31 Post by Redman » Tue Oct 25, 2011 12:40 pm

lamefun wrote:C++ will soon die in favor of better languages developed by Microsoft like C# and other .Net languages! Microsoft will likely develop even better languages!
How is C# better than C++? C# looks like clone of Java language to me.

User avatar
Quarko
Server supporter
Server supporter
Posts: 1227
Joined: Fri May 22, 2009 9:03 pm
Location: Kaunas, Lithuania

#32 Post by Quarko » Tue Oct 25, 2011 1:08 pm

Redman wrote:
lamefun wrote:C++ will soon die in favor of better languages developed by Microsoft like C# and other .Net languages! Microsoft will likely develop even better languages!
How is C# better than C++? C# looks like clone of Java language to me.
With all respect, both C# and Java are better than C++ in 99% cases. The problem is that 1% where someone still has to know C++.

lamefun
Dretch
Dretch
Posts: 67
Joined: Wed Aug 24, 2011 8:48 am

#33 Post by lamefun » Tue Oct 25, 2011 2:29 pm

Quarko wrote:
lamefun wrote:C++ will soon die in favor of better languages developed by Microsoft like C# and other .Net languages! Microsoft will likely develop even better languages!
A thing to think about: in what language is .Net framework written? :D
Do you know about compiler bootstrapping? I'm sure that even if .Net is in C++ now, it'll soon be in C#.

User avatar
Redman
Marauder
Marauder
Posts: 403
Joined: Fri Apr 03, 2009 6:00 pm
Location: Walbrzych, Poland

#34 Post by Redman » Tue Oct 25, 2011 3:09 pm

Quarko wrote:
Redman wrote:
lamefun wrote:C++ will soon die in favor of better languages developed by Microsoft like C# and other .Net languages! Microsoft will likely develop even better languages!
How is C# better than C++? C# looks like clone of Java language to me.
With all respect, both C# and Java are better than C++ in 99% cases. The problem is that 1% where someone still has to know C++.
Then it's weird that most games, video editors, graphics editors, sound editors, libraries, operating systems and other programs were written in C/C++, not Java or C#.

User avatar
Lanac
Tyrant
Tyrant
Posts: 865
Joined: Fri Sep 10, 2010 4:18 pm
Location: Idk...

#35 Post by Lanac » Sat Oct 29, 2011 7:57 pm

So, since no one helped much :(, i had to learn everything myself and i managed to make a task without anyones help(only one friend told me that for chars is %c, not %d, so i had some weird result ^^), and i wanna share it here, if someone know how does it even work:

Code: Select all

#include <iostream>
#include <stdio>

using namespace std;

int main&#40;&#41;
&#123;
    int x;
    int y=0;
    char f,g,h,i,j;
    scanf&#40;"%d",&x&#41;;
    scanf&#40;" %c",&f&#41;;
    scanf&#40;" %c",&g&#41;;
    scanf&#40;" %c",&h&#41;;
    scanf&#40;" %c",&i&#41;;
    scanf&#40;" %c",&j&#41;;
    int a=x/10000;
    x=x%10000;
    int b=x/1000;
    x=x%1000;
    int c=x/100;
    x=x%100;
    int d=x/10;
    x=x%10;
    int e=x;
    if&#40;f=='D'&#41;  y=y+a;
    if&#40;g=='D'&#41;  y=y+b;
    if&#40;h=='D'&#41;  y=y+c;
    if&#40;i=='D'&#41;  y=y+d;
    if&#40;j=='D'&#41;  y=y+e;
    printf&#40;"%d",y&#41;;
    return 0;
&#125;
I amde it in 30 mins, and i know a skilled programmer would make it in 2 minutes, but im not a pro ^^
My Youtube Channel:
Please help my ass and click on link, im a poor bitch...(+ ill make some trem videos too :D)
http://adf.ly/2qaKp

User avatar
Redman
Marauder
Marauder
Posts: 403
Joined: Fri Apr 03, 2009 6:00 pm
Location: Walbrzych, Poland

#36 Post by Redman » Sat Oct 29, 2011 9:31 pm

I think this program was supposed to load a 5-digit integer and set every n-th digit to zero if n-th character is not 'D'. I would do it that way:

Code: Select all

int main&#40;&#41;
&#123;
 int i,n;
 char c&#91;5&#93;, ns&#91;6&#93;;
 scanf&#40;"%d %c%c%c%c%c",&x,&c&#91;0&#93;,&c&#91;1&#93;,&c&#91;2&#93;,&c&#91;3&#93;,&c&#91;4&#93;,&c&#91;5&#93;&#41;;
 snprintf&#40;ns,6,"%i",n&#41;;
 for&#40;i=0;i<5;i++&#41;
  if&#40;c&#91;i&#93;!='D'&#41; ns&#91;i&#93;='0';
 printf&#40;"%s",ns&#41;;
&#125;

User avatar
Quarko
Server supporter
Server supporter
Posts: 1227
Joined: Fri May 22, 2009 9:03 pm
Location: Kaunas, Lithuania

#37 Post by Quarko » Sat Oct 29, 2011 9:42 pm

Redman wrote:I think this program was supposed to load a 5-digit integer and set every n-th digit to zero if n-th character is not 'D'. I would do it that way:

Code: Select all

int main&#40;&#41;
&#123;
 int i,n;
 char c&#91;5&#93;, ns&#91;6&#93;;
 scanf&#40;"%d %c%c%c%c%c",&x,&c&#91;0&#93;,&c&#91;1&#93;,&c&#91;2&#93;,&c&#91;3&#93;,&c&#91;4&#93;,&c&#91;5&#93;&#41;;
 snprintf&#40;ns,6,"%i",n&#41;;
 for&#40;i=0;i<5;i++&#41;
  if&#40;c&#91;i&#93;!='D'&#41; ns&#91;i&#93;='0';
 printf&#40;"%s",ns&#41;;
&#125;
Wrong. His code does this:
Input: Source 5 digit number (for example: 12345)
Input: Mask of operations (for example: D00D0)
Result: Sum of all digits that correspond to letter 'D' in given mask. Our example: 1 + 4 = 5 (because first letter D corresponds to '1' and last letter D to '4')

User avatar
Lanac
Tyrant
Tyrant
Posts: 865
Joined: Fri Sep 10, 2010 4:18 pm
Location: Idk...

#38 Post by Lanac » Sun Oct 30, 2011 8:09 am

Quarko wrote:
Redman wrote:I think this program was supposed to load a 5-digit integer and set every n-th digit to zero if n-th character is not 'D'. I would do it that way:

Code: Select all

int main&#40;&#41;
&#123;
 int i,n;
 char c&#91;5&#93;, ns&#91;6&#93;;
 scanf&#40;"%d %c%c%c%c%c",&x,&c&#91;0&#93;,&c&#91;1&#93;,&c&#91;2&#93;,&c&#91;3&#93;,&c&#91;4&#93;,&c&#91;5&#93;&#41;;
 snprintf&#40;ns,6,"%i",n&#41;;
 for&#40;i=0;i<5;i++&#41;
  if&#40;c&#91;i&#93;!='D'&#41; ns&#91;i&#93;='0';
 printf&#40;"%s",ns&#41;;
&#125;
Wrong. His code does this:
Input: Source 5 digit number (for example: 12345)
Input: Mask of operations (for example: D00D0)
Result: Sum of all digits that correspond to letter 'D' in given mask. Our example: 1 + 4 = 5 (because first letter D corresponds to '1' and last letter D to '4')
Quarko is right. First input is 5 digit numb, after that its D OR K(d=dugi=long) or K(k=kratki=short). And then make sum of all digits that had D in its position and ignore any other char :)
My Youtube Channel:
Please help my ass and click on link, im a poor bitch...(+ ill make some trem videos too :D)
http://adf.ly/2qaKp

User avatar
Nod_Nod_Nod
Tyrant
Tyrant
Posts: 1079
Joined: Sun Mar 14, 2010 6:58 pm
Location: Poland
Contact:

#39 Post by Nod_Nod_Nod » Sun Oct 30, 2011 12:06 pm

I too made a program, but im not sure if I made any mistakes.

Code: Select all

#include <iostream> 
#include <cstdio> 
#include <conio>
#include <quarko>
using namespace std; 

int main&#40;&#41; 
&#123;
cout << "Hello World";
cin.ignore;
getchar&#40;&#41;;
return 0;
&#125;
Buahahhah Hhah haha Lol
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"

lamefun
Dretch
Dretch
Posts: 67
Joined: Wed Aug 24, 2011 8:48 am

#40 Post by lamefun » Sun Jun 02, 2013 3:11 pm

I take my words about .NET back, it's now clear that JavaScript is becoming the official programming language of planet Earth! Even GNU/Linux community has adopted it, KDE 5 will be completely inseparable from it and GNOME 3 has already chosen it as the official recommended programming language!

User avatar
imp
Basilisk
Basilisk
Posts: 299
Joined: Thu Mar 21, 2013 11:52 am

#41 Post by imp » Sun Jun 02, 2013 4:16 pm

lamefun wrote:JavaScript is becoming the official programming language of planet Earth!!
I don't think so.

Pikachu
Dretch
Dretch
Posts: 82
Joined: Thu May 02, 2013 1:05 am

#42 Post by Pikachu » Tue Jun 04, 2013 4:59 pm

Personally, I'dd start with something more simple.
this language is a good candidate for beginners.
zap zap zap

Post Reply