Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h> //library of output and input functions
- #include<conio.h> //library of screen cleaning and other service
- #include<math.h> //library of mathematical functions
- #include<iostream>
- using namespace std;
- void main()
- { // main function - entry point to the programm
- char simbol;
- puts("function puts():"); //displaying the message on the screen
- puts("input symbol"); //displaying the message on the screen
- putchar(getch()); //output the symbol, what doesn't display during the entering
- puts("\n repeat input symbol-function getch():"); //output the message
- simbol=getch(); //input symbol from the keyboard
- putchar(simbol); //output symbol on the screen
- char str[20];
- puts("\n input string -function gets():"); //output te message on the screen
- gets(str); //input string
- printf("functions printf(),puts(): str="); //formatted output
- puts(str); //output string
- printf("\r\n function printf(): str=%s \r\n",str); //formatted output string
- int i;
- double a,b,c,d;
- puts("function scanf(),printf()");
- printf("\n input integer i, double a,b,c \n"); // formatted output
- scanf("%i%d%d%d",&i,&a,&b,&c); //formatted input
- printf("i=%i a=%d b=%d c=%d", i,a,b,c); //formatted output
- puts("\n input string for sscanf() as %d %f %f or sprintf()");
- char str1[40],str2[40];
- float a1,b1;
- fflush(stdin); // cleaning the keyboard buffer
- gets(str1); //input string from keyboard
- printf("string is: ");
- puts(str1);
- sscanf(str1,"&d %f %f", &i, &a1, &b1); // input from string to the addresses of variables
- printf("i=%i a=%f b=%e\n",i,a1,b1); //output on the screen
- puts("function sprintf() does not display rezult");
- sprintf(str2,"i=%d a=%f b=%e",i,a1,b1); // output into the string
- puts("function puts():");
- puts(str2);
- d=(a-abs(a/b))/(2.75*sin(c)*sin(c));//calculating the expression
- puts("function printf():");
- printf("d=(a-abs(a/b)/2.75*pow(sin(c),2)=%d",d);
- char string[30]; //announce the string
- cout<<"\n input text"<<endl;
- cin>>string;
- cout<<"entered text is"<<"'"<<string<<"'"<<endl;
- fflush(stdin);
- getch(); //delay screen
- }
Add Comment
Please, Sign In to add comment