An "lvalue" is a value that can be the target of an assignment. The "l" stands for "left", as in the left hand side of the equals sign. An rvalue is the right hand value and produces a value, and cannot be assigned to directly. If you are getting "lvalue required" you have an expression that produces an rvalue when an lvalue is required
using namespace std;
int n, i;
float num, sum=0.0, average;
cout << "Enter the numbers of data: ";
cin >> n;
while (n > 100 || n <= 0)
cout << "Error! number should in range of (1 to 100)." << endl;
cout << "Enter the number again: ";
cin >> n;
for(i = 0; i < n; ++i)
cout << i + 1 << ". Enter number: ";
cin >> num[i];
sum += num[i];
average = sum / n;
cout << "Average = " << average;
C program for two number average
/* c program find sum and average of two numbers*/
printf("Enter first number :");
printf("Enter second number :");
printf("\nSum of %d and %d is = %d",a,b,sum);
printf("\nAverage of %d and %d is = %f",a,b,avg);
Still any doubt , let me know
Firstly I would like to highlight the fact that global and local variables CAN have same names however its not usually a good practice. Coming to the point this is a case of accessibility. You are having same names of variable but only the local variable is accessible in the Add() method so you are not getting any error.
@bodhisatva but I think the answer will be
Jaipur is a city of vibrant colours and hues and the new market places that have come in the place of shopping malls which now give the visitors a mixed view of old and traditional.
You'd see this behavior if you didn't go through the process of creating a Codeblocks C project.
You have to use File menu/New/Project in CodeBlocks. Since it is a console app to print out hello world select "Console Application". Then select C or C++, and then fill in the information about the project. Once the project is created you can insert your own files and headers. The console application will create a default "main" function that you'll want to replace.
That's pretty basic 🙂
Here the poet is trying to describe how he feels on a rainy day. He states that when it rains he start recalling all his past memories. He lays on his bed in a cottage and listens to the pitter patter sound of the rain. As he keeps on listening to the sound of rain he start remembering his old days when he used to be a lil boy. He remembers his mother who is not with him now, bt he says that her memories are still with him. He remembers how his mother used to take care of him during rainy days so that he might not catch a cold. He remembers all the sweet memories of his past while listening to the sound of the rain
James Kirkup’s poem ‘No Men Are Foreign’ definitely deals with the ideas of brotherhood and equality. According to the poet, no matter what kind of a uniform a soldier wears, he is still human and has the element of humanity within him. Changes in uniform doesn't mean that the others are alien or foreign since everybody breathes the same air, drinks the same water and would also die on the same earth. He further goes on to explain that everybody also has the same features like eyes that wake or sleep.What the poet believes is that if a war breaks out then humans would be killing their brothers and not some alien/foreign soldiers since humanity is present in all soldiers irrespective of the countries they belong to. The poet concludes that since all men are equal due to the presence of humanity, any war/battles fought between them will be futile and purposeless. This poem is about unity and universal brotherhood since the element of humanity is given precedence over the differences present within the identities of soldiers due to their various countries. They are born equal since they have humanity present within them.