>I really need that code
Then write it. That's what I do when I really need code for something.
>I have a text file
>and I want to convert it vector or array
I'm sure you've used cin's >> operator to read integers from standard input. What you did was read a stream of text and convert it to int, though most of that work happened under the hood. You can do the same thing with your file:
#include <fstream>
int main()
{
std::ifstream in("myfile");
int x;
if (in && in>> x)
std::cout<< x <<" squared is "<< x * x <<'\n';
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401