שאלה בC++

The WizardMan

New member
שאלה בC++

יש לי טיפוס 'שבר' (CFragment) ורציתי לכתוב פונקציית קליטה לאובייקט מסוג זה. אני מקבל error שאומר: error C2678: binary '>>' : no operator defined which takes a left-hand operand of type 'class istream_withassign' (or there is no acceptable conversion) כאשר אני עושה קריאה cin >> frag1; מה לא בסדר בקוד ?
 

The WizardMan

New member
הקוד

istream & operator>> (istream &is, const CFragment &frag) { cout << "Enter numerator for fragment:"; is >>frag.numerator; cout << endl << "Enter denominator for fragment:"; is >> frag.denominator; return is; }
 

אמיר ט

New member
תנסה אולי basic_istream

בכל מקרה מחר אני בעבודה (עבודה... צבא) ובדיוק כתבתי שם איזה משהו כזה אז אני אסתכל בדיוק איך זה אמור להיות
 

The WizardMan

New member
מצטער , טעות שלי

זה מהטעויות הקטנות שלא שמים לב אליהם כתבתי איפשהו ostream במקום istream תודה בכל מקרה ...
 
למעלה