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

Top 10 Ford Truck Tragedies

 Joe Kucinski
story-1

AEV FXL Super Duty - the Super Duty Raptor Ford Doesn't Make

 Brett Foote
story-2

Lobo Vs Lobo: Proof the F-150 Lobo Should Be Even Lower!

 Michael S. Palmer
story-3

Ford's 2001 Explorer Sportsman Concept Looks For a New Home

 Verdad Gallardo
story-4

10 Best Ford Truck Engines We Miss the Most!

 Joe Kucinski
story-5

2026 Shelby F-150 Off-Road: Better Than a Raptor R?

 Brett Foote
story-6

2027 Super Duty Carhartt Package First Look: 12 Things You NEED to Know!

 Michael S. Palmer
story-7

10 Most Surprising 2026 Ford Truck Features!

 Joe Kucinski
story-8

Top 10 Ford Trucks Coming to Mecum Indy 2026

 Brett Foote
story-9

5 Best / 5 Worst Ford Truck Wheels of All Time

 Joe Kucinski
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,946
Likes: 62
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,946
Likes: 62
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 04:25 PM.

story-0
Top 10 Ford Truck Tragedies

Slideshow: Top 10 Ford truck tragedies.

By Joe Kucinski | 2026-05-18 19:34:33


VIEW MORE
story-1
AEV FXL Super Duty - the Super Duty Raptor Ford Doesn't Make

And it might be even better than that.

By Brett Foote | 2026-05-18 19:26:42


VIEW MORE
story-2
Lobo Vs Lobo: Proof the F-150 Lobo Should Be Even Lower!

Slideshow: Does lowering an F-150 Lobo RUIN the ride quality?

By Michael S. Palmer | 2026-05-18 19:20:37


VIEW MORE
story-3
Ford's 2001 Explorer Sportsman Concept Looks For a New Home

Slideshow: Ford's bizarre fishing-themed Explorer concept has resurfaced after spending decades largely forgotten.

By Verdad Gallardo | 2026-05-12 18:07:46


VIEW MORE
story-4
10 Best Ford Truck Engines We Miss the Most!

Slideshow: The 10 best Ford truck engines we miss the most.

By Joe Kucinski | 2026-05-12 13:09:47


VIEW MORE
story-5
2026 Shelby F-150 Off-Road: Better Than a Raptor R?

Slideshow: first look at the 810 hp 2026 Shelby F-150 Off-Road!

By Brett Foote | 2026-05-12 12:50:07


VIEW MORE
story-6
2027 Super Duty Carhartt Package First Look: 12 Things You NEED to Know!

Slideshow: Everything You Need to Know about the 2027 Super Duty Carhartt Package!

By Michael S. Palmer | 2026-05-07 17:51:06


VIEW MORE
story-7
10 Most Surprising 2026 Ford Truck Features!

Slideshow: 10 most surprising Ford truck options/features in 2026.

By Joe Kucinski | 2026-05-05 11:17:22


VIEW MORE
story-8
Top 10 Ford Trucks Coming to Mecum Indy 2026

Slideshow: Here are the top 10 Fords coming to Mecum Indy 2026.

By Brett Foote | 2026-05-04 13:49:49


VIEW MORE
story-9
5 Best / 5 Worst Ford Truck Wheels of All Time

Slideshow: The 5 best and 5 worst Ford truck wheels of all time

By Joe Kucinski | 2026-04-29 16:49:01


VIEW MORE