I'll try to get this as simple as possible. The problem is fairly simple.

long double a=100000000;
cout<<a;

Well, the output this shows is "1e+08"

I do not want the output to be in exponential form. Rather, I want it to be printed as "100000000".

What shall I do?

Thnaks in advance.

Use std::fixed.

cout << std::fixed << a;

Use std::fixed.

cout << std::fixed << a;

Hi...Thanks for a response.

But, I am getting the following errors:-

Type qualifier 'std' must be a struct or class anme in function main()

Statement misisng in function main()

The errors occur when the program is as follows:-

#include<iostream.h>
#include<conio.h>

void main()

{
	 long double a=100000000.0;
 cout<<std::fixed<<a;
 getch();
}

Which compiler are you using?

#include<iostream>
using namespace std;

int main()
{
  long double a=100000000.0;
  cout<<std::fixed<<a;
  return 0;
 }

Use CodeBlocks compiler.

I'm using Turbo C++ 4.5

From where can I download codeblocks compiler?

"cout" doesn't support any specific formatting. You can use printf defined under stdio. Use a corresponding qualifier.

commented: wow, what a pile on... +6
commented: I dont agree at all!! -1
commented: Fail! -2
commented: What has said below -4
commented: Don't yell what you don't know -2
commented: No - I don't agree. +0

I'm using Turbo C++ 4.5

From where can I download codeblocks compiler?

CodeBlocks

Include iomanip header file and use setiosflags(ios::fixed,ios::adjustfield) manipulator.

Mark this thread as Solved if you get solution.

"cout" doesn't support any specific formatting.

cout supports a lot of formatting options, and you can add more. It is a very flexible design, much more flexible than printf. But the design is very verbose and convoluted compared to printf.

You can use printf defined under stdio. Use a corresponding qualifier.

I agree. For most of the formatting jobs that printf can do, it is shorter and probably faster that cout. Which makes more sense here when printing fixed format with no precision?

#include <iostream>
#include <iomanip>
#include <cstdio>

using namespace std;

int main()
{
    long double value = 100000000.0;

    // chained modifiers on cout
    cout << fixed << setprecision(0) << value << '\n';

    // printf with a format string
    printf("%.0f\n", value);
}

The cout line is a little over twice as long, and it is not as obvious what the output will look like by skimming the code. I think formatting macros embedded in an output string are easier to figure out, but not having to type all of that extra junk is a big win.

Thanks for help everyone. Well, the problem si that I don't know how a printf function works. A link to guide on using printf would be highly appreciated.

This page is kind of Linux-centric, but the printf info should be standard.

Thanks...I'll be checking that out.

Ok, Ok, Everyone screwed me. But, I felt that printf would be easier to format.

commented: "printf" is often easier. unfortunately, that the way you worded your response was incorrect. +11
commented: Those guys just can't handle different opinions. +1