Solved

Simple Error in C++ Code

Posted on 2003-12-11
2
230 Views
Last Modified: 2010-04-01

Hi.  What's wrong with this?  Thanks!

NOTE: "finish" and "now" are doubles supplied to the function

/******* CODE ****************/

double minarr;
minarr = 2;

if minarr >= ((finish - now) / 365)                        
{
//some code here
}

/******* ERROR ***************/

D:\test\test.cpp(664) : error C2061: syntax error : identifier 'minarr'
D:\test\test.cpp(665) : error C2143: syntax error : missing ';' before '{'

/****************************/
0
Comment
Question by:malramsay
2 Comments
 
LVL 9

Accepted Solution

by:
tinchos earned 50 total points
ID: 9925097
Hi malramsay,

you're missing the () that encloses the condition

try with this


double minarr;
minarr = 2;

if( minarr >= ((finish - now) / 365) )
{
//some code here
}

Cheers!
Tincho
0
 

Author Comment

by:malramsay
ID: 9925601

Thanks Tincho.  I knew it would be easy!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now