Solved

Simple Error in C++ Code

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

919 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

16 Experts available now in Live!

Get 1:1 Help Now