Notices
General NON-Automotive Conversation No Political, Sexual or Religious topics please.

Need C++ programming help ASAP

Thread Tools
 
Search this Thread
 
Old Jan 12, 2009 | 01:19 AM
  #1  
Jimmy Dean's Avatar
Jimmy Dean
Thread Starter
|
Postmaster
Joined: Mar 2003
Posts: 4,513
Likes: 0
From: La Tech University, La
Need C++ programming help ASAP

Here is my program:

#include <iostream>
#include <enmvec>
using namespace std;
using namespace ENM;
double diam, vol, pitch, span, rad, diamExposed;
double NWS(double inches)
{
inches = ( vol * 231.0 ) / ( sqrt( diamExposed ( 2.0 * rad - diamExposed ) ) * span + 0.5 * rad * 0.01745 * rad * 2 * acos( 1 - ( diamExposed / rad ) ) - ( 2 * sqrt( diamExposed * ( 2 * rad - diamExposed ) ) ) * ( rad - diamExposed ) );
return inches;
}
int main(void)
{
double inchesRain = 0.0;
rad = diam / 2.0;
diamExposed = 0.0;
cout << "Enter the volume of the Corley Calibrated Bucket ";
cout << "(CCB) in gallons: ";
cin >> vol;
cout << "\nEnter the diameter of the CCB in inches: ";
cin >> diam;
cout << "\nEnter the rise of the roof, in inches, over a twelve ";
cout << "inch span: ";
cin >> pitch;
cout << "\nEnter the total span of the roof, drip line to drip ";
cout << "line, in feet: ";
cin >> span;
cout << '\n' << '\n';
cout << "Inches of CBB diameter exposed:" << '\t' << '\t';
cout << "Inches of NWS rain: \n";
if ( diamExposed == 0.0 )
{
cout << diamExposed << "\t \t \t The NWS rainfall cannot be calculated. \n";
}
else if ( diamExposed < diam )
{
while ( diamExposed < diam )
{
cout << diamExposed << "\t \t \t \t \t" << NWS(inchesRain);
diamExposed = diamExposed + ( 1.0 / 8.0 );
}
}
else
{
cout << diamExposed << "\t \t \t \t \t" << NWS(inchesRain);
}
}



I am getting error 2314 in line 8

that is the line in the NWS function block that contains the really long function inches = ...............

can anyone tell me where/what I am screwing up?
 
Reply
Old Jan 12, 2009 | 02:53 AM
  #2  
Jimmy Dean's Avatar
Jimmy Dean
Thread Starter
|
Postmaster
Joined: Mar 2003
Posts: 4,513
Likes: 0
From: La Tech University, La
n/m, I found it.
 
Reply
Old Jan 12, 2009 | 06:06 AM
  #3  
shorebird's Avatar
shorebird
Hotshot
Joined: Feb 2003
Posts: 11,537
Likes: 27
From: Long Beach, Ms.
I'm glad you found it as my programming experience ended with Fortran and punched tape in Jr. High.
 
Reply
Old Jan 12, 2009 | 06:11 AM
  #4  
Jimmy Dean's Avatar
Jimmy Dean
Thread Starter
|
Postmaster
Joined: Mar 2003
Posts: 4,513
Likes: 0
From: La Tech University, La
and he shows his age.... :P
 
Reply
Old Jan 12, 2009 | 10:52 AM
  #5  
pfogle's Avatar
pfogle
Lead Driver
20 Year Member
Joined: Feb 2003
Posts: 8,140
Likes: 4
From: Oak Harbor, OH
I never used all the spaces to save file size (one space equals 8 bits, that's a LOT of bits...). It does make it easier to see but with the new c++ compilers the spaces only matter in the actual function names.
 
Reply
Old Jan 12, 2009 | 11:45 AM
  #6  
dchamberlain's Avatar
dchamberlain
Lead Driver
15 Year Member
Liked
Loved
Community Favorite
Joined: Sep 2007
Posts: 8,180
Likes: 669
From: Scio, OR
Club FTE Silver Member

So what was it? I never got as far as learning C or C++. I did a lot of stuff a loooong time ago in BASIC and COBOL (high school and college) and then Pascal (college and then I wrote a program for my employer that took time clock data, compiled it and allowed supervisors to call up the data, correct errors and approve the data and then formatted it to be input into the ADP payroll program).

But I'm just naturally curious.
 
Reply
Old Jan 12, 2009 | 11:55 AM
  #7  
jake00's Avatar
jake00
Hotshot
20 Year Member
Joined: Apr 2004
Posts: 13,589
Likes: 2
From: NW burbs of chicago
Club FTE Gold Member
COBOL allowed me to see mamny sunrises in college
 
Reply
Old Jan 12, 2009 | 11:58 AM
  #8  
pfogle's Avatar
pfogle
Lead Driver
20 Year Member
Joined: Feb 2003
Posts: 8,140
Likes: 4
From: Oak Harbor, OH
I used to be able to speak forth, FORTRAN, pascal, basic, COBOL, and COMOL (a weird derivative of COBOL developed for the business community on a C64). Those were the days.... I'm only 28 btw.
 
Reply
FTE Stories

Ford Trucks for Ford Truck Enthusiasts

story-0

10 Ways Ford is LOSING to the Competition

 Joe Kucinski
story-1

Top 6 Best Deals Available on New Fords & Lincolns Right Now

 Brett Foote
story-2

This Hennessey Takes the Expedition Tremor's Off-Roading Capability to the Next Level

 Verdad Gallardo
story-3

Top 10 Fords at 2026 Carlisle Ford Nationals

 Joe Kucinski
story-4

3 Best / 3 Worst Parts of Modern Ford Ownership

 Brett Foote
story-5

10 Amazing Upgrades That Solve Common Ford Truck Owner Headaches

 Pouria Savadkouei
story-6

Every 2026 Ford Engine Explained

 Brett Foote
story-7

10 Ugly Ford Trucks That We Still Kinda Love

 Joe Kucinski
story-8

10 Things Every Truck Owner NEEDS (2026 Edition)

 Michael S. Palmer
story-9

Rezvani's Latest Post-Apocalyptic Monster Is a Ford F-150 Raptor Underneath

 Verdad Gallardo
Old Jan 12, 2009 | 12:14 PM
  #9  
Vijay's Avatar
Vijay
Posting Guru
Joined: Oct 2005
Posts: 2,220
Likes: 2
From: CA
Can you paste only line 8 here? The ads make up few extra lines( to the right), so I'm not really sure what line 8 is...
 
Reply
Old Jan 12, 2009 | 12:40 PM
  #10  
NewEnglandHerdsman's Avatar
NewEnglandHerdsman
Lead Driver
20 Year Member
Photogenic
Photoriffic
Liked
Joined: Jul 2004
Posts: 5,947
Likes: 63
From: in the woods of MA
Club FTE Silver Member

Ah... "diamExposed" is declared as a variable, but also used (inadvertently) as a function name? I.e. there's a missing '*' operator?
 
Reply
Old Jan 12, 2009 | 03:16 PM
  #11  
quaddriver's Avatar
quaddriver
Cargo Master
20 Year Member
Joined: Jan 2004
Posts: 2,512
Likes: 8
From: Cook Forest and Irwin PA
'error 2314' is helpful.

may I suggest - you need a new compiler.
 
Reply
Old Jan 12, 2009 | 03:34 PM
  #12  
Jimmy Dean's Avatar
Jimmy Dean
Thread Starter
|
Postmaster
Joined: Mar 2003
Posts: 4,513
Likes: 0
From: La Tech University, La
Yup New England, that was exactly the problem. I spent 3 friggin hours chasin down that thing, I can't tell you how many times I looked right over it.
 
Reply
Old Jan 12, 2009 | 05:21 PM
  #13  
NewEnglandHerdsman's Avatar
NewEnglandHerdsman
Lead Driver
20 Year Member
Photogenic
Photoriffic
Liked
Joined: Jul 2004
Posts: 5,947
Likes: 63
From: in the woods of MA
Club FTE Silver Member

Originally Posted by Jimmy Dean
Yup New England, that was exactly the problem. I spent 3 friggin hours chasin down that thing, I can't tell you how many times I looked right over it.
I find those real long computational lines very error prone and hard to debug. When I have something like that to code I tend to do (at least the initial versions) by breaking it up into several lines and using lot of intermediate variables - that way it's easy to see where any computational errors are being introduced, and it also gives the the compiler more lines with less code on each line to point at. Once you get it all coded right and debugged you can condense it to one line if you like, but most compilers will be using lots of registers to store intermediate results anyway, so there's not really any cost to leaving it expanded...
 
Reply
Old Jan 13, 2009 | 06:36 PM
  #14  
Greywolf's Avatar
Greywolf
Fleet Owner
Joined: Aug 2001
Posts: 29,941
Likes: 46
From: Drummonds, TN USA


I be dipped in doo-doo....

I looked at "C++ for Dummies" long ago, and thought it was a thing I wanted to learn.

Never mind - I'm happy struggling along with advanced HTML and all the rest that allows me to communicate here..

"Any sufficiently advanced technology is indestinguishable from magic"

the logical extension to that is therefore:

"A PRACTITIONER THEREOF IS NO LESS THAN A SORCEROR, MAGICIAN, OR WITCH"


Good luck to you then in your esoteric persuits!!!

After all - someone MUST so do...





Technology and it's several markets are their own necessity
 
Reply
Old Jan 13, 2009 | 07:31 PM
  #15  
fmc400's Avatar
fmc400
MSEE
Joined: Apr 2004
Posts: 10,386
Likes: 35
From: Austin, TX
Club FTE Gold Member
Originally Posted by pfogle
I never used all the spaces to save file size (one space equals 8 bits, that's a LOT of bits...). It does make it easier to see but with the new c++ compilers the spaces only matter in the actual function names.
Compilers have ignored white-space since the beginning of time.
 
Reply



All times are GMT -5. The time now is 06:56 PM.

story-0
10 Ways Ford is LOSING to the Competition

Slideshow: 10 ways Ford is losing to the competition

By Joe Kucinski | 2026-06-15 09:52:01


VIEW MORE
story-1
Top 6 Best Deals Available on New Fords & Lincolns Right Now

Some great targets in today's expensive world.

By Brett Foote | 2026-06-15 09:35:19


VIEW MORE
story-2
This Hennessey Takes the Expedition Tremor's Off-Roading Capability to the Next Level

Slideshow: The VelociRaptor Expedition gains a lift, upgraded suspension, Brembo brakes, and trail-ready equipment while retaining the stock 440-horsepower EcoBoost V6.

By Verdad Gallardo | 2026-06-12 11:01:55


VIEW MORE
story-3
Top 10 Fords at 2026 Carlisle Ford Nationals

Slideshow: Top 10 Fords at 2026 Ford Nationals

By Joe Kucinski | 2026-06-09 11:10:08


VIEW MORE
story-4
3 Best / 3 Worst Parts of Modern Ford Ownership

Based on years of owning multiple modern Ford products.

By Brett Foote | 2026-06-09 10:53:36


VIEW MORE
story-5
10 Amazing Upgrades That Solve Common Ford Truck Owner Headaches

SPONSORED: From muddy boots to rain-soaked cargo, these upgrades address some of the most common frustrations Ford truck owners face every day.

By Pouria Savadkouei | 2026-06-08 18:50:34


VIEW MORE
story-6
Every 2026 Ford Engine Explained

Here's everything you need to know about every Ford engine available for the 2026 model year.

By Brett Foote | 2026-06-05 12:58:01


VIEW MORE
story-7
10 Ugly Ford Trucks That We Still Kinda Love

Slideshow: 10 ugly Ford trucks that we still kinda love.

By Joe Kucinski | 2026-06-03 09:51:16


VIEW MORE
story-8
10 Things Every Truck Owner NEEDS (2026 Edition)

Slideshow: the best gifts for dads & grads

By Michael S. Palmer | 2026-06-03 15:43:58


VIEW MORE
story-9
Rezvani's Latest Post-Apocalyptic Monster Is a Ford F-150 Raptor Underneath

Slideshow: Called the Fortress, the 850-horsepower pickup combines Raptor underpinnings with military-inspired features, survival equipment, and a starting price of $285,000.

By Verdad Gallardo | 2026-06-03 11:38:36


VIEW MORE