Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Why wont this compile?

Name: Anonymous 2007-04-12 8:54 ID:/L93LvWT

#include <ctime>
using namespace std;
int main()
{
    //Array processing
    int info[5][2];     //Array with 10 elements
    int amt, amto, amtt, amtr, amtv;
    int x=0;          //counter
    int y;            //number of elements in array
    int value=0;      //input value
    int total=0;      //total
    float average;    //average
    int stop=0;
   
    cout<<"\nThis program will calculate the average of up to 10 numbers\n";
    while(value!=-1)
    {
            cout<<"Enter sales ID number: ";
            cin>>value;
            if (value=1)
            {
              cout<<"Enter sales amount: ";
              cin>>amto;
            )
            else if (value=2)
            {
              cout<<"Enter sales amount: ";
              cin>>amtt;
            )
            else if (value=3)
            {
              cout<<"Enter sales amount: ";
              cin>>amtr;
            )
            else if (value=4)
            {
              cout<<"Enter sales amount: ";
              cin>>amtf;
            )
            else if (value=5)
            {
              cout<<"Enter sales amount: ";
              cin>>amtv;
            }
            }

There's more stuff after it, but this is what's important.

I keep getting these errors.
"27 expected primary-expression before ')' token "
"27 expected `;' before ')' token "

Can anyone help me!?

Name: Anonymous 2007-04-13 10:33 ID:t9NZtfrS

Ok, forgive me, I don't code in C so I was mistaken. You DO have to declare a function before use, however you don't have to give your prototype a parameter list. This compiles perfectly:

void fourchan();

int main()
{
 int dickNipples;
 fourchan(dickNipples);
 return 0;
}

void fourchan(int pDickNipples)
{
}

And because of this feature alone C DOESN'T and CAN'T have function polymorphism.
void fourchan();
void fourchan(char shit);

int main()
{
 int dickNipples;
 fourchan(dickNipples);
 fourchan('&');
 return 0;
}

void fourchan(int pDickNipples)
{
}

void fourchan(char pShit)
{
}

This isn't even mentioning how you C fags reinvent the wheel everytime you pass a structure pointer to a function, forgetting that classes in C++ could easily do that job for you and take away the unnecessary micro-management.

Unless you're in driver or kernel development you have no fucking reason to code in C.

>>14
You're a dumbass but I'll bite. No, you're not coding in C++ unless you use C++ constructs. C++ was made to be [largely] backwards compatible with C, blah blah blah, buy more ram. Forced indentation of code, thread over.

And bloated? I dare you look into how classes actually look once compiled. Many contructs in C++ are just meant to be a concept for abstraction, meaning they don't actually "become" code. I'm just saying that many C developers would find it easier if they ran their code through a C++ compiler and -maybe- use a few of the features provided since C++'s tighter restrictions will undoubtedly fix many of the bugs before they happen.

Name: Anonymous 2007-04-13 21:10 ID:t9NZtfrS

>>44
Wow, that's quite a broad generalization for a language with such a large developer base. And honestly, you're not special for understanding pointers. We all know you just learned about pointers last week but please, shut your mouth about it.

Do you care to point out how I, >>18, am wrong and you are so very right? Did I hurt your feelings?

What's funny with your post is that most C programmers I know are just too damn lazy to learn anything -beyond- C. They just picked out the thinnest programming book at the store that they could find, read it a few times and spend the rest of their time telling programmers of other languages how great they are in comparison and jerking eachother off in their respective forums.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List