I've got this code, and for some reason the cin.get does not assign a value to the p.name[i]. I don't know why, but getline does not work aswell. I've tried to just cin.get(temp,30), to read a temp, but this dont work in the for cycle.
#include <iostream>
#include <string>
using namespace std;
typedef struct echip
{
    char name[30];
    double price;
};
void read(echip* p, int n)
{
    for (int i = 0; i < n; i++)
    {
        cout << "Name: ";
        cin.get((p + i)->name, 30);
        cin.ignore();
        cout << (p + i)->name;
        cout << "Price: "; cin >> (p+i)->price;
        cout << (p+i)->price;
    }
}
int main()
{
    echip* k;
    int n;
    cout << "Number: "; cin >> n;
    k = new echip[n];
    read(k, n);
    delete[] k;
    return 0;
}
 
     
    