I will assume you want to read from the console and you already have iostream included because your question is ambiguous. If you want to read a single string without spaces use the below method:
struct Data
{
  string name;
  int number;
};
int main()
{
    Data t[n];
    for(int i=0; i < n; i++) 
    { 
      std::cin >> t[i].name;
      std::cin >> t[i].number;
    }
}
This will retrieve the a single string from the console. Also your struct needs a semicolon after the ending curly bracket.
In the case that you want the full line with spaces, you could use:
getline();
This will retrieve the full line from any file or the console.
Refer to the documentation for the full details here.