944,208 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 10116
  • C++ RSS
Mar 15th, 2005
0

exponents in c++

Expand Post »
how do you write exponents in c++ i though it was "exp (#)" afterthe variable am i right?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
tyczj is offline Offline
91 posts
since Mar 2005
Mar 15th, 2005
0

Re: exponents in c++

As a constant?
#include <iostream>

int main()
{
   double value = 1.23456E+3;
   std::cout << "value = " << value << '\n';
   return 0;
}

/* my output
value = 1234.56
*/
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Mar 15th, 2005
0

Re: exponents in c++

no not as a constant but never mind i figured it out.

i have another question though, im getting an error and i have no clue what it means?

"error c2447: missing function header (old-style formal list)"
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
tyczj is offline Offline
91 posts
since Mar 2005
Mar 15th, 2005
0

Re: exponents in c++

>"error c2447: missing function header (old-style formal list)"
And the line of code that goes with this error? Clearly you're trying to do something that looks something like a K&R style function definition, but C++ doesn't allow those.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 15th, 2005
0

Re: exponents in c++

um not sure what K&R is; have not learned that yet but the line where the error is the "{" right after main to start writing the code
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
tyczj is offline Offline
91 posts
since Mar 2005
Mar 15th, 2005
0

Re: exponents in c++

>um not sure what K&R is
You aren't supposed to unless you have a perverse fascination with ancient dialects of C.

>the line where the error is the "{" right after main
That is soooooo incredibly NOT helpful. Not even I can debug a program given one character (most of the time ). How about posting that line as well as five lines above it (using code tags, because I'm not in the best of moods).
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Reading data into files
Next Thread in C++ Forum Timeline: PUTTING C++ TO USE!!! (GUIs & MS Windows)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC