Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple Error in C++ Code

Posted on 2003-12-11
2
Medium Priority
?
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
tinchos earned 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

721 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