Page 3 of 3

Posted: Tue Oct 25, 2011 12:40 pm
by Redman
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.

Posted: Tue Oct 25, 2011 1:08 pm
by Quarko
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++.

Posted: Tue Oct 25, 2011 2:29 pm
by lamefun
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#.

Posted: Tue Oct 25, 2011 3:09 pm
by Redman
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#.

Posted: Sat Oct 29, 2011 7:57 pm
by Lanac
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 ^^

Posted: Sat Oct 29, 2011 9:31 pm
by Redman
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;

Posted: Sat Oct 29, 2011 9:42 pm
by Quarko
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')

Posted: Sun Oct 30, 2011 8:09 am
by Lanac
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 :)

Posted: Sun Oct 30, 2011 12:06 pm
by Nod_Nod_Nod
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

Posted: Sun Jun 02, 2013 3:11 pm
by lamefun
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!

Posted: Sun Jun 02, 2013 4:16 pm
by imp
lamefun wrote:JavaScript is becoming the official programming language of planet Earth!!
I don't think so.

Posted: Tue Jun 04, 2013 4:59 pm
by Pikachu
Personally, I'dd start with something more simple.
this language is a good candidate for beginners.