Oct 3, 2014 at 8:17pm Oct 3, 2014 at 8:17pm UTC
1 2 3
string yow[3][2];
getline(cin,yow[0][1]);
cout<<yow;
why is it not working?
Last edited on Oct 3, 2014 at 8:17pm Oct 3, 2014 at 8:17pm UTC
Oct 3, 2014 at 9:18pm Oct 3, 2014 at 9:18pm UTC
cout is demanding to be more specific
Oct 3, 2014 at 10:04pm Oct 3, 2014 at 10:04pm UTC
hello ,
just use ( std :: ) before getline() or use ( using namespace std;) before main function
like this
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string yow[3][2];
getline(cin,yow[0][1]);
cout<<yow;
return 0;
}
here is output of this code
see the online output of any code at this page ::
http://codepad.org
choose your programming language and put your code in that form , then press submit
after a while you will see the output !!!
Last edited on Oct 3, 2014 at 10:05pm Oct 3, 2014 at 10:05pm UTC
Oct 3, 2014 at 11:00pm Oct 3, 2014 at 11:00pm UTC
You need to specify what element of your array you want to print.
Oct 3, 2014 at 11:29pm Oct 3, 2014 at 11:29pm UTC
your right MiiNiPaa
program will gets a line ( string ) as an input , then prints the address of yaw variable
for example :
input :1654654654
output : 0x7fff1e9653f0
but that website......
Sorry guys !!!
Oct 3, 2014 at 11:38pm Oct 3, 2014 at 11:38pm UTC
@jib even if i specify the output of the array it still gives me incorrect results
Oct 3, 2014 at 11:44pm Oct 3, 2014 at 11:44pm UTC
@miinPaa ill send you my code as a pm
Oct 3, 2014 at 11:46pm Oct 3, 2014 at 11:46pm UTC
the admin pin number is 0000
Oct 4, 2014 at 7:26am Oct 4, 2014 at 7:26am UTC
were you able to correct the my codes?
Oct 4, 2014 at 7:30am Oct 4, 2014 at 7:30am UTC
thanks i was able to do it but is there any other way because the <limits> was not discussed to us yet
Oct 4, 2014 at 7:41am Oct 4, 2014 at 7:41am UTC
Answer gives you 2 solutions and describes why second one is superior. Why everyone uses first one?
Use std::cin >> ws;
Alternatively, you can just pass large number (like 1000) as ignore() first parameter.