Old fart here, still a horrible newbie.

Tonight, I've actually got a working solution for my problem, but the book I'm reading is unclear about something, and I'm having trouble getting Google to give me the the exact answer I want. Given,

//Header junk
//CandyBar struct
int main()
    CandyBar * pt = new CandyBar[3];
    //This init works
    pt[0].brand = "Three Musketeers";
    pt[0].weight = .33;
    pt[0].calories = 200;
    //This init does not work
    pt[1] = {"Hershey's", .45, 225};
    //input, output already work, hallelujah
    delete pt;

    return 0;

...how do I push bracketed input into a new struct array like I'm failing to do with pt[1]? Banging out multiple-row initializations is really clumsy. If, for some reason, the answer is, "don't do that," I'll accept that, too.

Edited by grib: "No" is an answer, too.

7 Years
Discussion Span
Last Post by programmersbook
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.