|
From: Iván S. L. <iva...@gm...> - 2009-02-04 20:26:53
|
You may want to mean
if (n % div == 0)
instead of
if (n % div = 0)
Unfortunately, compilers not always says the truth!
Greetings.
Ivan.
Heedle Blambeedle wrote:
> Here is my code:
>
> #include <iostream>
>
> using namespace std;
>
> int main ()
> {
> int n;
> int div = 0;
> bool primenum = true;
> cout << "Enter an integer: ";
> cin >> n;
> do {
> div = div + 1;
> if (n % div = 0)
> {
> cout << "Divisible By " << div << " ." << endl;
> primenum = false;
> }
> if (n % div != 0)
> {
> cout << "Not Divisible By" << div << " ." << endl;
> }
> } while (div <= n / 2 + 1); */_/* this line has the error*/_/*
> if (primenum == false)
> {
> cout << "IS PRIME." << endl;
> }
> if (primenum == true)
> {
> cout << "IS NOT PRIME." << endl;
> }
> system("pause > nul");
> return (0);
> }
>
> And here is my question:
>
> I recieve a non-lvalue error in the line with "this line has the error".
>
> What the heck is a non-lvalue error and how do I fix it?
>
> My system specs (though I don't think they'll matter) :
>
> Microsoft Windows XP
> Service Pack 3
>
> Intel Pentium 4
> 504 MB RAM
> 3.06 GHZ of processing
>
>
> Thank you so much.
>
> Heedle
>
> P.S. Please don't disregard my questions because there are so many of
> them. I say again, I am new to C++.
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> ------------------------------------------------------------------------
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|