Аналог С-ского scanf в php

Profic

just Profic (PHP5 BetaTeam)
Ксати, автор похоже даже не пробовал компилять это чудо:
Код:
cin>>"Enter your name">>variable;
Это бред. И ни один нормальный компилятор не скомпилит такое.
Код:
#include <iostream>
int main() {
	using namespace std;
	int variable;
	cin >> "Enter your name" >> variable;
	return 0;
}
И результат:
Код:
E:\work\web\SDN\recipe-nddocs\cpp>c:\devel\mingw\bin\g++ test5.cpp
test5.cpp: In function `int main()':
test5.cpp:6: error: ambiguous overload for 'operator>>' in 'std::cin >> "Enter your name"'
c:/devel/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/istream:687: note: candidates are: std::basic_
istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*) [with _Traits = std::char_tr
aits<char>] <near match>
c:/devel/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/istream:692: note:                 std::basic_
istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*) [with _Traits = std::char_trai
ts<char>] <near match>
Ч.т.д. :)
 

Profic

just Profic (PHP5 BetaTeam)
Я подключал iostream.h
Какая разница. С iostream.h вылезает еще один warning:
Код:
In file included from c:/devel/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward/iostream.h:31,
                 from test5.cpp:1:
c:/devel/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #wa
rning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found
 in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ incl
udes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
 

SMiX

Guest
Не знаю, у меня все работало... Если найду учебник, отсканю и покажу страницу с описанием этого.
 

nerezus

Вселенский отказник
SMiX
ты прав, тебе надо найти учебник...

но не показать нечто такое, чего там нету ;) , а прочитать его...
ты в этом ноль... так что сиди читай, учи... все же с чего-то начинали...
 
Сверху