Solved

Simple Error in C++ Code

Posted on 2003-12-11
2
233 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

830 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