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

some C++ question

Name: that nigger 2009-04-02 2:29

so /prog/rammers can you tell me why this only returns
x=1 y=1
I'm trying to have it return the values that equal 133745639

heres the code:

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
unsigned long int x = 1;
unsigned long int y = 1;
unsigned long int z;


while ( z != 133745639)
{
z = x * y ;

if ( z = 133745639 )
{
cout << "x=" << x << "y=" << y << endl;
}
else
x++;
}
system("PAUSE");
return 0;

}

Name: Anonymous 2009-04-02 19:22

>>22
There's a point because standards can change and because new languages ought not to copy C's retardation. The problem is exactly the notation for testing equality and assigning to variables.
if (a_foo = find_foo()) work_on(a_foo));

You'd have to be an idiot to think it's good to make a language difficult to write correct code in, reasoning that the compiler can catch it. Even if it can catch it, I've got better things to do with my time than to manually fix bugs brought on by poor language design choices. Especially in a batch compiled language like C.

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