is printf and cout are the same? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

is printf and cout are the same?

#include<stdio.h> #include<conio.h> main() { float RpH,Hwork,OTh,OTr,OT,GP; clrscr(); printf("input the employees rate per hour(RpH)":); scanf("%f",RpH) printf("input the number of hours work(Hwork)":); scanf("%f",Hwork); printf("input the Overtime rate of employee(OTr)":); scanf("%f",OTr); if (Hwork>8) OTh=Hwork-8; OT=OTh*OTr; GP=(RpH*8)+OT; printf("Gross Pay is %.2f",GP); else if (Hwork<=8 && Hwork>0) GP=Rph*Hwork; printf("Gross Pay is %.2f",GP); else printf("Your Fired!!!"); getch; }

29th Jan 2017, 4:01 AM
Arjay S. Meru
2 Answers
+ 6
printf() is a function, cout is a global object of std.
29th Jan 2017, 4:38 AM
Hatsy Rei
Hatsy Rei - avatar
- 1
**cout it means write to screen whatever is there.. **printf() f stand for format/formatter that is... you can leave for strings and add them as parameters.. eg x = "string" printf("this is %s.",x) that will output "this is string" printf helps you when you have values already in variables or else you would have to do it "this is "+x saves the trouble of adding +s
29th Jan 2017, 5:00 AM
Pankaj Vaghela
Pankaj Vaghela - avatar