Search
 
SCRIPT & CODE EXAMPLE
 

CPP

printf in c++

#include <cstdio>

int main(){

char c = 'S';

float x = 7.0, y = 9.0;

double d = 6.548;

int i = 50;

printf("The float division is : %.3f / %.3f = %.3f 
", x,y,x/y);

printf("The double value is : %.4f 
", d);

printf("Setting the width of c : %*c 
",3,c);

printf("The octal equivalent of %d is %o 
",i,i);

printf("The hex equivalent of %d is %x 
",i,i);

return 0;

}
Comment

c++ custom printf

int aclass::printf(const char * format, ...) {
	if (this->silent > 0) return 0;

	va_list arg;
	int done;

	va_start(arg, format);
	done = std::vfprintf(stdout, format, arg);
	va_end(arg);

	return done;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: deque 
Cpp :: c++ constructor 
Cpp :: c++ string example 
Cpp :: c++ visual studio 
Cpp :: map of maps c++ 
Cpp :: c++ add everything in a vector 
Cpp :: Initialize Vector Iterator with end() function 
Cpp :: cpp algorithm iota 
Cpp :: c++ read entire file into a variable 
Cpp :: progress indicator raytracer 
Cpp :: vector insert to end 
Cpp :: how to do if command in c++ 
Cpp :: 1822. Sign of the Product of an Array leetcode in c++ 
Cpp :: no of balanced substrings 
Cpp :: fabs c c++ 
Cpp :: nmake.exe is not found in the windows 
Cpp :: how to code a game in c++ 
Cpp :: c++ Difference Array | Range update query in O(1) 
Cpp :: Get the absolute path of a boost filePath as a string 
Cpp :: sort vector in descending order c++ 
Cpp :: Missing GL version 
Cpp :: how to save system function output into a variable in c++ 
Cpp :: C++ std::ofstream class members 
Cpp :: how to add values in empty array using python 
Cpp :: how are c++ references implemented 
Cpp :: c++ merging algorithm 
Cpp :: return multiple objects from a function C++ using references 
Cpp :: c ++ loop 
Cpp :: days in a year c++ 
Cpp :: leetcode 36 c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =