C++ :: Error / Expression Must Have Integral Or Enumtype

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


ADVERTISEMENT

C++ :: IntelliSense - Expression Must Have Integral Or Unscoped Enum Type

Sep 6, 2014

So far I have the following code:

// Purpose: To write a program that displays the number of millimeters higher the current level the ocean level will be in
// in 5, 7, and 10 years.

# include <iostream>
# include <string>
using namespace std;
int main() {
float X = 10;
string Y="";

[Code] ....

But I get the following error message:

IntelliSense: expession must have integral or unscoped enum type

three times in a row for lines 25, 27, and 29 and I don't understand or know why?

In case the purpose does make sense here are the directions:

2.7: Ocean Levels

Assuming the ocean’s level is currently rising at about 1.5 millimeters per year, write a program that displays

•The number of millimeters higher than the current level that the ocean’s level will be in 5 years,
•The number of millimeters higher than the current level that the ocean’s level will be in 7 years,
•The number of millimeters higher than the current level that the ocean’s level will be in 10 years,

Output labels:

Each value should be on a line by itself, preceded by the a label of the form:

In X years the ocean's level will be higher by Y millimeters.

where X is the number of years (5, 7 or 10) and Y is the value you calculate.

View 16 Replies View Related

C :: Syntax Error In Expression Near If

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

C :: Error - Invalid Use Of Void Expression

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

C++ :: Unexpected Expression Compiler Error

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

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 View Related

C++ :: Compiler Error - Expression Must Have A Constant Value

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

C++ :: Error / Expression Must Have A Class Type

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

C :: Stack Overflow - Expected Expression Error

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

C++ :: Thread Error - Illegal Operation On Bound Member Function Expression

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

C/C++ :: Two Array Member Pass As Parameter - Expression Syntax Error For Function

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

C :: How To Evaluate Double Integral

Oct 6, 2014

I am very new to programming and would like to know where to even start when evaluating a double integral. I wanted to evaluate this double integral: 6x^3 + y^2 +7x from 0 to 1 (for both).

View 1 Replies View Related

C :: Trapezoidal Approx Of An Integral

Aug 2, 2013

One of my last programs to write was to use the trapezoidal rule to approx. the definite integral defined in the program. It works, now i am looking for ways to improve this code, if there are any.

Code:
#include<stdlib.h>#include<stdio.h>
#include<math.h>
double integral (double x);
int main(void){

[Code] ....

the output is simple:

Code: ssma-imac:ENG-3211 ssma$ ./integralThe integral of x^2 Sin(x) dx from 1 to 5 is -18.953841

And yes this is a very good approximation of the actual integral.

View 9 Replies View Related

C++ :: Calculate Integral Using Rectangles

Feb 13, 2013

I have a function written to calculate an integral using rectangles. I get this error: 'cannot convert double to double (*) (double) in assignment'. But whenever I remove one of the doubles something is undeclared.

double rect_integral(double a, double b, int n, int f) {

double x;
double (* fx) (double);

double func_1 = 5*(pow(x,4))+3*(pow(x,2))-10*(x)+2;
double func_2 = pow(x,2)-10;

[Code] .....

View 3 Replies View Related

C++ :: Const Static Integral Members

Jan 16, 2014

I've been having a problem concerning the initialization of const static integral members with floating point calculations. I'll let his sample program do the explaining:

class Foo {
public :
Foo() {}
const static int samplerate = 44100;
const static unsigned short tempo = 120;

[Code].....

I know you can't initialize const static non-integral types on the same line on which they're declared, but I don't see why even an implicit cast to an integral type should be disallowed. I make my calculations using doubles, so I'm surprised that even though it should degenerate into an integer - it's still a problem for the compiler.

View 1 Replies View Related

C++ :: How To Use Templated Varadic Sequences And Integral Sequence Wrappers

Jul 15, 2013

I've been studying the heck out of the boost metafunction libraries. I understand a good deal of what things like varadic functions and integral sequence wrappers are, but I am having a hard time putting everything together to get working functions, such as performing arithmetic operations or functions like that of std::vector.

Here is an example of what I'm talking about:

// Sequences
template<typename T... N> struct seq;
template<typename T, T... N> struct seq_c;

// Integral constant wrapper
template<int T> struct int_

[Code] .....

My knowledge of all of this is pretty scattered and I've really been trying hard to put it all together. Is this correct? How can I apply this and use it to do more?

View 5 Replies View Related

C++ :: Expression Must Have Constant Value?

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

C++ :: ATM - Expected Primary Expression Before Else

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

C++ :: Expression Must Have A Class Type?

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

C :: Expected Expression Before Token

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

C :: Building NFA From Regular Expression

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

C :: Calculation Of A Bitwise Expression

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

C++ :: Expected Primary Expression Before INT

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

C++ :: Expression - Value Returning Function

Dec 17, 2014

How is the definition of the term "expression" affected by value returning functions, and why?

View 5 Replies View Related

C++ :: How To Create BST For Arithmetic Expression

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

C++ :: Cannot Appear In A Constant-expression (list)

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







Copyrights 2005-15 www.BigResource.com, All rights reserved