題目描述C++讀寫問題題目來源及自己的思路不知道怎么用鏈表通過read()函數怎么調用,其中head是頭指針相關代碼// 請把代碼文本粘貼到下方(請勿用圖片代替代碼)infile.open("student.txt",ios::in); infile.read((char *)head,sizeof(student)); while(infile){cout<<head->num<<"t"; cout<<head->name<<"t"; cout<<head->score<<endl; head=head->next; infile.read((char *)head,sizeof(student)); }infile.close();}你期待的結果是什么?實際看到的錯誤信息又是什么?
1 回答

慕勒3428872
TA貢獻1848條經驗 獲得超6個贊
這寫的好亂啊,head頭指針保存數據嗎?head傳入參數要變為const char…………infile是fstream流對嗎?read(unsigned char buf,int num);
t 也打錯了
添加回答
舉報
0/150
提交
取消