//This program doesn't allow me to give all input
#include<iostream>
#include<string>
#include<conio.h>
struct food
{
std::string name;
float diameter;
float weight;
};
int main()
{
using namespace std;
food *pizza = new food[3];
cout<<"\nEnter detail: ";
cout<<"\nDiameter: ";
cin>>(*pizza).diameter;
cout<<"\nName: ";
getline(cin, pizza->name);
cout<<"\nWeight: ";
cin>>pizza->weight;
cout<<endl<<pizza->name<<" has weight "<<pizza->weight<<" and diameter "<<pizza->diameter;
getch();
return 0;
}
Do not mix stream operators and getline.
If you absolutely need to use getline — use cin.ignore() before that.