Author Topic: I need a HELP!!  (Read 6458 times)

0 Members and 1 Guest are viewing this topic.

Offline kriminal

  • /dev/null
  • *
  • Posts: 11
  • Cookies: 0
    • View Profile
Re: I need a HELP!!
« Reply #15 on: September 03, 2011, 07:26:24 am »
Is C and C++ programming have a big difference?

Offline gh0st

  • Sir
  • ***
  • Posts: 575
  • Cookies: 8
  • #DEDSec
    • View Profile
Re: I need a HELP!!
« Reply #16 on: September 03, 2011, 08:25:45 am »
It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C language. Originally named C with Classes, the language was later renamed C++ in 1983.

Offline xzid

  • Knight
  • **
  • Posts: 329
  • Cookies: 41
    • View Profile
Re: I need a HELP!!
« Reply #17 on: September 03, 2011, 09:22:36 am »
It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C language. Originally named C with Classes, the language was later renamed C++ in 1983.

Oh that wiki! What you posted is completely misleading gh0st. Although as long as we're referring to the C++ wiki page, this quote is just perfect:

Quote
Richard Stallman criticizes C++ for having ambiguous grammar and "gratuitous, trivial, incompatibilities with C (...) that are of no great benefit".

Linus Torvalds has said, "C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it".

Is C and C++ programming have a big difference?

A huge difference.

C++ provides alot of additional features, none of which help the C language. You learn alot more stuff, but none of it seems to help. Not once have I programmed C and thought: "You know what's missing here? Classes, templates and overloaded functions!!!".

C is used for low-level, if you want to do kernel, network, system programming(Security/Hacking falls under this category as well)... There is no other language. The extent of OOP are functions pointers(example of something that looks OOP is LKM programming). C forces you to know exactly what your program is doing.. Say you wanna use the IP protocol, well there are no shortcuts... refer to the rfc. This is also the reason every C programmer will eventually move on to ASM, to learn exactly what his C program(and his computer) is doing. C can do pretty much everything, although on things like GUI will be a headache more than anything.

C++ has it uses as well, say GUI, game programming, large applications with 101 different things built into it. If this is what you seek, java might be a better way to go.

Offline kriminal

  • /dev/null
  • *
  • Posts: 11
  • Cookies: 0
    • View Profile
Re: I need a HELP!!
« Reply #18 on: September 04, 2011, 07:41:47 pm »
I don't have an idea about this problem. Can anyone who can teach me how to solve this problem in C++ using for loop..


Write a program to scan a number n and then output the sum of the squares from 1 to n. Thus, if the input is 4, the output should be 30 because:

            12 + 22 + 32 + 42 = 1+4+9+16 = 30

Offline kriminal

  • /dev/null
  • *
  • Posts: 11
  • Cookies: 0
    • View Profile
Re: I need a HELP!!
« Reply #19 on: September 04, 2011, 08:59:05 pm »
  • #include <iostream.h>
  • int main()
  • {
  •     int n, i, sum;
  •     cout << "Enter a value for n: ";
  •     cin >> n;
  •     sum = 0;
  •     i = 1;
  •     do
  •     {
  •         sum += i*i;
  •         i++;
  •     }while (i <= n);
  •     cout << "The sum of the first " << n
  •     << " numbers is " << sum << endl;
  •     return 0;
  • }

This is my idea. Not yet compiled.