You might be wrong: printf and scanf are usable in C++ just as in C. With format specifiers.
There are many types of format specifier. Exp:%d (To show the integer) %c(To show the character) %f(Float are digits with decimal points to use it to show them) %s(String to show the string)
take care of the data types of variables declared and format specifiers
%e expects a corresponding argument of type double; %f expects a corresponding argument of type float.
You can certainly do that ... printf ("This is a number: 12345\n"); ... but that does not have the same value as placing the value in a variable and converting the variable into a string ... int i = 12345; printf ("This is a number: %d\n", i); That's the whole point of format specifiers - to initiate a conversion from one place to another.
what is the pure algorithm instead of cpp program?
Format specifier is a sequence passed the as the formatting data as by argument
format specifier also called as control specifier or variable formatters. format string also called arguments.
The storage class specifiers in C and C++ are:autoexternmutableregisterstatictypedefA storage class specifier is used to refine the declaration of a variable, a function, and parameters
take care of the data types of variables declared and format specifiers
There are many types of format specifier. Exp:%d (To show the integer) %c(To show the character) %f(Float are digits with decimal points to use it to show them) %s(String to show the string)
CPP
take care of the data types of variables declared and format specifiers
CPP Group was created in 1980.
Satya
%e expects a corresponding argument of type double; %f expects a corresponding argument of type float.
Format specifiers are not necessary because we can use the much more flexible insertion operator to insert formatted text in an output stream, or the extraction operator to extract formatted data from an input stream. Format specifiers are simply far too low-level and can only handle built-in data types such as strings, integrals and floats, they cannot handle more complex data types such as classes and data structures and we cannot create new specifiers to cater for them. But in C++ we can simply overload the insertion and extraction operators to cater for any data type we wish, thus providing a consistent means of inserting any object into an input stream or extracting it from an output stream.
You can certainly do that ... printf ("This is a number: 12345\n"); ... but that does not have the same value as placing the value in a variable and converting the variable into a string ... int i = 12345; printf ("This is a number: %d\n", i); That's the whole point of format specifiers - to initiate a conversion from one place to another.