format long double
- bisz
- Użytkownik
- Posty: 572
- Rejestracja: 13 paź 2004, o 18:29
- Płeć: Mężczyzna
- Lokalizacja: Szczecin
- Podziękował: 4 razy
- Pomógł: 27 razy
format long double
jakiego w C z komendy printf uzywac operatora do poprawnego wydruku formatu long double, bo o ile int ma %d, float ma %f, double ma %lf o tyle jezeli wpisze %lf do long doubla to drukuje mi bzdury ktos wie ?
-
- Użytkownik
- Posty: 971
- Rejestracja: 27 wrz 2005, o 22:56
- Płeć: Mężczyzna
- Lokalizacja: Wrocław
- Podziękował: 11 razy
- Pomógł: 75 razy
format long double
Poczytaj sobie:
print format specifiers have the following form
% [flags] [width] [.prec] [F|N|h|l|L] type_char
Each format specifier begins with the percent character (%).
After the % come the following optional specifiers, in this order:
Optional Format String Components
These are the general aspects of output formatting controlled by the optional characters, specifiers, and modifiers in the format string:
Component Optional/Required What it Controls or Specifies
[flags] (Optional) Flag character(s) Output justification, numeric signs, decimal points, trailing zeros, octal and hex prefixes
[width] (Optional) Width specifier Minimum number of characters to print, padding with blanks or zeros
[prec] (Optional) Precision specifier Maximum number of characters to print; for integers, minimum number of digits to print
[F|N|h|l|L] (Optional) Input size modifier Override default size of next input argument:
N = near pointer
F = far pointer
h = short int
l = long
L = long double
type_char (Required) Conversion-type character:
Numerics
d Integer signed decimal integer
i Integer signed decimal integer
o Integer unsigned octal integer
u Integer unsigned decimal integer
x Integer unsigned hexadecimal int (with a, b, c, d, e, f)
X Integer unsigned hexadecimal int (with A, B, C, D, E, F)
f Floating point signed value of the form [-]dddd.dddd.
e Floating point signed value of the form [-]d.dddd or e[+/-]ddd
g Floating point signed value in either e or f form, based on given value and precision. Trailing zeros and the decimal point are printed if necessary.
E Floating point Same as e; with E for exponent.
G Floating point Same as g; with E for exponent if e format used
Characters
c Character Single character
s String pointer Prints characters until a null-terminator is pressed or precision is reached
% None Prints the % character
Pointers
n Pointer to int Stores (in the location pointed to by the input argument) a count of the chars written so far.
p Pointer Prints the input argument as a pointer; format depends on which memory model was used. It will be either XXXX:YYYY or YYYY (offset only).
print format specifiers have the following form
% [flags] [width] [.prec] [F|N|h|l|L] type_char
Each format specifier begins with the percent character (%).
After the % come the following optional specifiers, in this order:
Optional Format String Components
These are the general aspects of output formatting controlled by the optional characters, specifiers, and modifiers in the format string:
Component Optional/Required What it Controls or Specifies
[flags] (Optional) Flag character(s) Output justification, numeric signs, decimal points, trailing zeros, octal and hex prefixes
[width] (Optional) Width specifier Minimum number of characters to print, padding with blanks or zeros
[prec] (Optional) Precision specifier Maximum number of characters to print; for integers, minimum number of digits to print
[F|N|h|l|L] (Optional) Input size modifier Override default size of next input argument:
N = near pointer
F = far pointer
h = short int
l = long
L = long double
type_char (Required) Conversion-type character:
Numerics
d Integer signed decimal integer
i Integer signed decimal integer
o Integer unsigned octal integer
u Integer unsigned decimal integer
x Integer unsigned hexadecimal int (with a, b, c, d, e, f)
X Integer unsigned hexadecimal int (with A, B, C, D, E, F)
f Floating point signed value of the form [-]dddd.dddd.
e Floating point signed value of the form [-]d.dddd or e[+/-]ddd
g Floating point signed value in either e or f form, based on given value and precision. Trailing zeros and the decimal point are printed if necessary.
E Floating point Same as e; with E for exponent.
G Floating point Same as g; with E for exponent if e format used
Characters
c Character Single character
s String pointer Prints characters until a null-terminator is pressed or precision is reached
% None Prints the % character
Pointers
n Pointer to int Stores (in the location pointed to by the input argument) a count of the chars written so far.
p Pointer Prints the input argument as a pointer; format depends on which memory model was used. It will be either XXXX:YYYY or YYYY (offset only).