Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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;

}
 
PREVIOUS NEXT
Tagged: #printf
ADD COMMENT
Topic
Name
2+3 =