1 Zulkigal

Non Lvalue In Assignment Co To Znaczy Cwel

This is due in 50 minutes, so hopefully this gets a quick response. I'm getting an error that the internet isn't giving a clear response for.

First and foremost (even if I get my program working), for posterity sake will someone please explain what the error "NON-LVALUE IN ASSIGNMENT" actually means?

OK, now that being said my instructor has asked the class to take our program to determine prime numbers and modify it by including a function. For the prime number test. It worked fine before, so I'm not really interested in modifying the logic to "make more sense" (as I see this type of suggestion a lot on here) I'm sure there are a billion different ways to do this. I just need to know what is broke and why, if I can understand the error I can fix the error.

===> I'm getting the aforementioned error on line 50 (I bolded it). Here's what I got so far:


// Kyle ######
// Program #5
#include <iostream>
#include <cmath>
#include <iomanip>
#include <windows.h>
using namespace std;
// Super Awesome Cake Function of Awesomeness
void cake ()
{
cout << setfill ('-') << setw(76) << "-" << endl;
cout << " And Now For Cake ... " << endl;
Sleep(1500);
cout << " ... I promise it's not poisoned";
Sleep(1250);
cout << " ... beyond human tollerances" << endl;
Sleep(2000);
cout << endl << endl << "Humans like ethyl benzene, right?" << endl;
Sleep(1500);
cout << setfill ('-') << setw(76) << "-" << endl << endl << endl;
cout << " ,:/+/-" << endl;
cout << " /M/ .,-=;//;-" << endl;
cout << " .:/= ;MH/, ,=/+%$XH@MM#@:" << endl;
cout << " -$##@+$###@H@MMM#######H:. -/H#" << endl;
cout << " .,H@H@ X######@ -H#####@+- -+H###@x" << endl;
cout << " .,@##H; +XM##M/, =%@###@X;-" << endl;
cout << "X%- :M##########$. .:%M###@%:" << endl;
cout << "M##H, +H@@@$/-. ,;$M###@%, -" << endl;
cout << "M###M=,,---,.-%%H####M$: ,+@##" << endl;
cout << "@##################@/. :%##@$-" << endl;
cout << "M################H, ;HM##M$=" << endl;
cout << "##################. .=$M##M$=" << endl;
cout << "#################H..;XM##M$= .:+" << endl;
cout << "M####################@%= =+@MH%" << endl;
cout << "@#################M/. =+H#X%=" << endl;
cout << "=+M###############M, -/X#X+;." << endl;
cout << " .;XM###########H= ,/X#H+:," << endl;
cout << " .=+HM#######M+/+HM@+=." << endl;
cout << " ,:/%XM####H/." << endl;
cout << " ,.:=-." << endl << endl << endl;
}
// Prime Number Testing Function
void primetest (int num1, int num2, bool& notprime)
{
// Declare Local Variables for Function: primetest
int count = num2 - 1;
// Primetest Logic
while (count >= num1)
{
if (num2 % count = 0) // <==============THIS IS THE LINE THE ERROR IS HAPPENING ON
{
cout << count << " ";
notprime = true;
}
count--;
}
}
// **[BEGIN MAIN FUNCTION]**
int main()
{
// Declare Local Variables for Main
int num1,num2;
bool notprime = false;
// Main Logic
// Inital Data Input
cout << endl;
cout << " .,-:;//;:=," << endl;
Sleep (100);
cout << " . :H@@@MM@M#H/.,+%;," << endl;
Sleep (100);
cout << " ,/X+ +M@@M@MM%=,-%HMMM@X/," << endl;
Sleep (100);
cout << " -+@MM; $M@@MH+-,;XMMMM@MMMM@+-" << endl;
Sleep (100);
cout << " ;@M@@M- XM@X;. -+XXXXXHHH@M@M#@/." << endl;
Sleep (100);
cout << " ,%MM@@MH ,@%= .---=-=:=,." << endl;
Sleep (100);
cout << " =@#@@@MX., -%HX$$%%%:;" << endl;
Sleep (100);
cout << " =-./@M@M$ .;@MMMM@MM:" << endl;
Sleep (100);
cout << " X@/ -$MM/ . +MM@@@M$" << endl;
Sleep (100);
cout << ",@M@H: :@: . =X#@@@@-" << endl;
Sleep (100);
cout << ",@@@MMX, . /H- ;@M@M=" << endl;
Sleep (100);
cout << ".H@@@@M@+, %MM+..%#$." << endl;
Sleep (100);
cout << " /MMMM@MMH/. XM@MH; =;" << endl;
Sleep (100);
cout << " /%+%$XHH@$= , .H@@@@MX," << endl;
Sleep (100);
cout << " .=--------. -%H.,@@@@@MX," << endl;
Sleep (100);
cout << " .%MM@@@HHHXX$$$%+- .:$MMX =M@@MM%." << endl;
Sleep (100);
cout << " =XMMM@MM@MM#H;,-+HMM@M+ /MMMX=" << endl;
Sleep (100);
cout << " =%@M@M#@$-.=$@MM@@@M; %M%=" << endl;
Sleep (100);
cout << " ,:+$+-,/H#MMMMMMM@= =," << endl;
Sleep (100);
cout << " =++%%%%+/:-." << endl << endl << endl;
Sleep (100);
cout << " Welcome to Apeture Science's Prime Number Test v2" << endl << endl;
Sleep (100);
cout << " -----------------------------------------------------" << endl;
Sleep (100);
cout << " | Cake to be served @ the conclusion of the test |" << endl;
Sleep (100);
cout << " | Poison content of cake varies by particiapant |" << endl;
Sleep (100);
cout << " -----------------------------------------------------" << endl << endl << endl;
Sleep (100);
cout << "Enter an integer greater than 2 for the lower end of the range (ENTER 0 TO QUIT): ";
cin >> num1;
cout << endl << endl;

while (num1 != 0)
{
// Test for number being greater than 2
while (num1 <= 2)
{
cout << setfill ('X') << setw(76) << "X" << endl;
cout << setfill ('X') << setw(38) << " ERROR " << setfill ('X') << setw(38) << "X" << endl;
cout << " | " << setw(4) << setfill( ' ' ) << num1 << " is not greater than 2. Please re-enter an integer greater than 2. |" << endl;
cout << setfill ('X') << setw(76) << "X" << endl << endl << endl;
cout << "Enter an integer greater than 2 for the lower end of the range (ENTER 0 TO QUIT): ";
cin >> num1;
cout << endl << endl;
}
// Input Upper Range Number
cout << "Enter an integer greater than " << num1 << " for the upper end of the range: ";
cin >> num2;
cout << endl << endl;
// Test for number being greater than low end number
while (num2 <= num1)
{
cout << setfill ('X') << setw(76) << "X" << endl;
cout << setfill ('X') << setw(38) << " ERROR " << setfill ('X') << setw(38) << "X" << endl;
cout << " | " << setw(4) << setfill( ' ' ) << num2 << " is not greater than " << num1 <<". |" << endl;
cout << setfill ('X') << setw(76) << "X" << endl << endl << endl;
cout << "Enter an integer greater than " << num1 << " for the upper end of the range: ";
cin >> num2;
cout << endl << endl;
}
cout << "The Prime Numbers between " << num1 << " and " << num2 << " are:";
// Call to Function: primetest
primetest (num1, num2, notprime);
// Final Output
if (!notprime)
{
cout << "[There are no prime numbers in that range.]" << endl << endl << endl; // [PRIME RESPONSE]
}
// Quit?
cout << "Enter an integer greater than 2 for the lower end of the range (ENTER 0 TO QUIT): ";
cin >> num1;
}
cake ();
system("pause");
return 0;
}

В нашем распоряжении будет целых два дня. - Но я уже забронировала номер, обиженно сказала Сьюзан.  - Нашу старую комнату в Стоун-Мэнор. - Я понимаю, но… - Сегодня у нас особый день - мы собирались отметить шесть месяцев.

Leave a Comment

(0 Comments)

Your email address will not be published. Required fields are marked *