CIN is the C + + standard, scanf is used in C
1#include <cstdio>2#include <iostream>3#include <cstring>4 5 using namespacestd;6 7 intMain ()8 {9 /*Ten strlen is included in the String.h header file, plus One #include <string.h> A #include <cstring>//C header file for string.h new C + + compiler, preceded by C, then removed. h - input char[] - */ the Chars[100100]; -Cin>>s; - //the difference between strlen and sizeof - intLen =strlen (s); + intSize =sizeof(s);//100100 -cout<<s<<" "<<len<<" "<<size<<Endl; + A //continuous input of multiple variables at Doublez,g; - inth; -Cin>>z>>g>>h; -cout<<z<<" "<<g<<" "<Endl; - - //Input String in stringstr; -Cin>>str; to intLen1 =str.length (); + intSize1 =str.size (); -cout<<str<<" "<<len1<<" "<<size1<<Endl; the * /* $ printf,scanf Two functions are included in the library file <stdio.h>. Panax Notoginseng continuous input of multiple variables - */ the Doublex, y; + intW; Ascanf"%lf%lf%d",&x,&y,&W); theprintf"%lf%lf%d", x,y,w); + return 0; -}
Plain Text Code
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace Std;
int main ()
{
/*
Strlencontained inString.hHeader file, plus
#include <string.h>
#include <cstring>//CThe Language header file isString.hNewC++compiler, Front PlusC, then remove. h
InputChar[]
*/
Char s[100100];
cin>>s;
StrlenAndsizeofThe difference
int len = strlen (s);
int size =sizeof (s);100100
cout<<s<<"" <<len<<"" <<size<<endl;
//Continuous input of multiple variables
Double z,g;
int h;
cin>>z>>g>>h;
cout<<z<<"" <<g<<"" <
//InputString
String str;
cin>>str;
int len1 = Str.length ();
int size1 = Str.size ();
cout<<str<<"" <<len1<<"" <<size1<<endl;
/*
printf,scanftwo functions are included in the library file <stdio.h> .
Continuous input of multiple variables
*/
double x, y;
int W;
scanf ("%lf%lf%d", &x,&y,&w);
printf ("%lf%lf%d", x,y,w);
return 0;
}
C + + Get keyboard input cin, scanf use detailed