C++ :: CXX0030 Error - Expression Cannot Be Evaluated
Mar 13, 2013
Any alternative method to what I'm trying to do if possible (not vectors, though). The error in question is on line 9.
#ifndef _TEST_H_
#define _TEST_H_
const int NUM = 10;
class CTest {
public :
[Code] .....
View 2 Replies
ADVERTISEMENT
Feb 3, 2013
I am using code::blocks for c programming and when i take debugger in below code it show ..
a syntax error in expression near "if"..
I am just checking debugger ...
Code:
#include <stdio.h>
#include <string.h>
int main()
{
char s1[100];
[Code] ....
View 7 Replies
View Related
Mar 14, 2014
I keep getting an error "Invalid use of void expression" on line 12.
Code:
#include<stdio.h>
#include<stdlib.h>
void initialiaze_array( int size );
void print_array( int size );
void replace( int num, int i );
[Code] ....
View 3 Replies
View Related
Jul 30, 2013
My compiler (GCC) keeps expecting an expression where it shouldn't in 1 specific piece of my code:
int zxcNewWindow( HWND parent, TCHAR *text, zxWINDOW *kid,
UINT style, int x, int y, int w, int h, int type )
// right here
{
*kid = zxDefWINDOW;
The project contains only 2 files right now and the settings are just the default for an empty Code::Blocks 12.11 project. Both files are in UTF-8 format (tried in ASCII too), I just cannot see why this is not compiling correctly. I'll post the files in the next two posts.
Edit: For those of you who didn't get what the error was from the above here's the full log:
mingw32-gcc.exe -Wall -g -DzxDEBUG -c C:MePrjscppzxGUImain.c -o objmain.o
C:MePrjscppzxGUImain.c: In function 'zxcNewWindow':
C:MePrjscppzxGUImain.c:39:10: error: expected expression before '{' token
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)
View 8 Replies
View Related
May 20, 2014
I am trying to run this source code but i am getting the compiler error Expression Must Have a Constant Value. I tried making both the variables x and y constants and assigned them to a significantly big number but then i am getting the error expression must be a modifiable lvalue.I have made comments in the code in front where Visual Studio is giving me the syntax error (red squiggly line).
#include<iostream>
#include <string>
#include<cmath>
using namespace std;
int main(){
int x;
int y;
[Code] ......
View 3 Replies
View Related
Mar 19, 2013
Code:
#include <iostream>
#include <iomanip>
using namespace std;
//chose to use #define since columns/rows are a constant in the program
#define x 5
#define y 3
int main() {
//declare variables
[code]....
View 8 Replies
View Related
Apr 15, 2015
I'm trying to learn recursion, and I'm using a simple array to experiment with it, but I have a couple of annoying errors that I don't understand why they're there. Here's the code:
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int largest(const int arr[], int lowerIndex, int upperIndex) {
int max;
[code]....
Now try to print the array backwards:
//Use a recursive algorithm to find the largest element in arr:
int largest(arr[], lowerIndex, upperIndex);//error: expected an expression
return 0;
}
View 14 Replies
View Related
Sep 10, 2013
I'm pretty new to C, and keep getting an error. Basically I'm trying to convert a ppm image to all red. Here is my code that I can't get to work:
Code:
change(pixel_t *PIXEL, &w, &h,pixel_t *buffer);
And here is the beginning of my convert function:
Code:
void change(pixel_t *pixel, int w, int h, pixel_t *buffer) {
int average, sum;
int i;
pixel_t *pointer;
Everything else works fine. I keep getting an error when I call the convert function. It says "expected expression before pixel_t" and "too few arguments to function "change". I know that everything else in the main is working.
View 3 Replies
View Related
May 14, 2014
I've written a program that finds the maximum of a function. I now want to change it a little so that instead of evaluating the function y=x^2-7x-18, the program will ask the user to input an equation and then evaluate that equation. I'm really not sure of how to do so.
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
int main() {
int a, b, delta, x, y;
double max= -1.8 * pow(10, 308);
[Code] .....
View 3 Replies
View Related
Sep 17, 2013
CODE:
class Secure {
private:
int seconds;
bool isRUNNING;
public:
Secure(int seconds) {
[Code] .....
ERROR:
error C2276: '&' : illegal operation on bound member function expression
I read that due to explicit casting, threads cannot be created within a class. I'm trying to thread a scanning system to relieve stress on my main program/module, rather than having the scanner stunt their performance.
View 4 Replies
View Related
Nov 8, 2013
In my project, GreedyKnap::calKnap(int nItem, int nCapacity, float fWeights, float fProfits);
This function include two array member pass as parameter. how can i do this?
View 1 Replies
View Related
Oct 23, 2013
line 27 and line 88 Im having a hard time figuring it out what the error is.
#include<iostream>
#include <cmath>
#include<algorithm>
[Code]....
View 2 Replies
View Related
Mar 29, 2014
I keep getting an error here and cant quite figure out why,
Code:
else if (mainMenu == 3){
cout << "Please make a selection" << endl
<< " 1) Withdraw from account" << endl
<< " 3) Back to main menu" << endl;
cin >> withdrawMenu;
if (withdrawMenu == 1){
[Code] ....
View 1 Replies
View Related
Apr 3, 2014
I am making a program that allows you to add two big numbers that are larger then what int can handle together. I think I have done everything to accomplish this but when I try to instantiate the program I get a error Expression must have a class type.
Here is my main file that is supposed to instantiate the program.
Code: #include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <conio.h>
#include "LargeIntegers.h"
using namespace std;
[code]....
View 10 Replies
View Related
Jun 18, 2014
I wrote a program, that generates 20 random integers, and stores them in an array. Then I decided, to build more functions to it, i.e why not have it to display the lowest integer of an array. I created my function,
Code:
int minValue( int field[ ] )
and got my code in side, which (technically) works. In my main() function I'm calling
Code:
printf( "The smallest value of an array is: %d
", minValue( field[] ) );
and I'm getting an error trying to compile it.
Code:
randomArray.c:62:74: error: expected expression before ']' token
printf( "The smallest value of an array is: %d
", minValue( field[] ) );
View 2 Replies
View Related
Oct 23, 2013
I am trying to create a NFA from a regular expression. I have a grasp on reading in the regular expression and being able to make a stack from it. The part I am struggling on is mapping the characters in the regular expression to an integer indicating the variables order in the expression. I am just not sure how to go about this.
My code so far...
Code:
#include<stdio.h>
#include<stdlib.h>
#include "stack.h"
int main(void)
{
char expression[80];//array to store regular expression
[Code] .....
View 6 Replies
View Related
Mar 6, 2015
I would like to ask about how we calculates the following bitwise expression.
Code:
unsigned char ch[2] = {0x49,0x49};
ch[0] | ch[1] << 8; I'm thinking ch[1] << 8 as 0x00 ...
So, I think that the above expression converts to 0x49 | 0x00 ... and the complete expression should be 0x49 for me.
But, the compiler gives me the result of 0x4949 as two bytes.How does the compiler calculate this expression as two bytes?show me the steps included in the calculation of this expression?
View 2 Replies
View Related
May 26, 2014
This is what i have example code in c++:
#include <iostream>
class Foo{
public:
void bar(){
std::cout << "Hello" << std::endl;
[Code] ....
After compiling it is giving error as :
foo.cpp: In function ‘int Foo_max(Foo*)’:
foo.cpp:26:37: error: expected primary-expression before ‘int’
foo.cpp:26:46: error: expected primary-expression before ‘int’
View 6 Replies
View Related
Dec 17, 2014
How is the definition of the term "expression" affected by value returning functions, and why?
View 5 Replies
View Related
Jan 15, 2015
I am a c++ leaner, I am trying to create a BST tree for this expression: 2346*+/8+, and do inorder and postorder to get the in-fix version, and postfix version of the expression. I am having difficulty to create the binary tree for the expression. Here is my peso code:
Tree:
Stack:
inorder fn{}
postorder fn{}
main{
input the file;
while(expression){
[Code] ....
The tree I want to create is like this
+
/
(/) 8
/
+ 2
/
* 3
/
4 6
My problem for this code is that after create (4*6) tree, I cant link (+3) with (4*6).
View 1 Replies
View Related
Aug 4, 2014
Why do I get the error 'rec' cannot appear in a constant-expression ?
I have the following definitions:
... string rec[6];
list<rec> musicList;
...
View 17 Replies
View Related
Mar 27, 2014
I thought that an operator performs a permanent change in a local variable. For example, if x is 00000000 00000000 00000000 00000011 (a 32 bit unsigned integer that resolves to value of 3) and p is 2, in the expression "return (x >> p) | (x << (s - p))", the right shift would permanently change x to 0 and the time we evaluate x again in "(x << (s - p))", x will already be 0. If that's the case, then this function doesn't make sense. This function makes it seem like that the >> and << operators do not change the value of x. It makes it seem like first we right shift x to 0 and then left shift by 20 bits to make x 11000000 00000000 00000000 00000000. If that's the case, then the function does exactly what it is supposed to do (rotate the bits). So which is it?
unsigned int rightrot(unsigned int x, unsigned int n) {
size_t s = sizeof(x) * CHAR_BIT;
size_t p;
if(n < s)
p = n;
[Code] ....
View 2 Replies
View Related
May 5, 2014
How can we implement an expression parser in C++.
View 3 Replies
View Related
Nov 4, 2013
Here is my objective: Write a c program that calculates the value of a mathematical expression comprised of positive numbers and the operations "+" and "-" . Specifically, first prompt the user to input an expression, read itin as a string, and then print the value of the expression. You may assume that the expression does not contain spaces, maximumsize of the expression (including digits and operators) can be 20,and that all numbers are single digit numbers.
Note that, the digits would be read in as characters; you will need to translate them to numbers (recall the ASCII table). Implementation Requirements:
Write a function called "evaluate" that takes as input a mathematical expression(as a string) and returns the value of the expression. The prototype of the function is: intevaluate(char expr[]);
Sample Output:
Input: 4+2-1+7 Output:12
Code:
int main()
{
char expr[21];
int a,ssum;
printf("Input: ");
scanf("%20s", expr);
[Code] .....
the program runs, but the output is not coming out correct.
View 11 Replies
View Related
Jul 9, 2013
Ok, I got everything else to work in a two part exercise except for the 2nd part.
The first part had me take up to 20 grades, calculate total, average, and then list the grades with a '*' next to ones that were lower than the average... good to go.
Now in the 2nd part of the exercise I have to also associate a letter grade with the grades in the list. I have done a "if else" chain, but am having an issue with multiple arguments and not sure if I have gone the right route.
Code:
//Cameron Taylor
#include <stdio.h>
#include <math.h>
#define MAXARRAY 20
[Code].....
View 9 Replies
View Related
Jan 22, 2014
How do to calculate the following equation"5+((56+8)/2)" using expression builder
Note: the equation may change "50+((26+8)/12)"
View 1 Replies
View Related