SZTUser 2022-03-02 23:28 采纳率: 0%
浏览 53

搞不清楚哪一步骤编译出错,该如何解决(语言-c++)

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
friend istream& operator >> (istream& in , PetDog<1,2,3,4,5.>& p){
    cout<<"[写入宠物信息]"<<endl;
    cout<<"序号:"<<endl;
    cin>>p.num;
    cout<<"种类:"<<endl;
    cin>>p.type;
    cout<<"年龄(岁)"<<endl;
    cin>>p.age;
    cout<<"体重(kg)"<<endl;
    cin>>p.weight;
    cout<<"状态(1为健康,2为生病):"<<endl;
    cin>>p.state;
    return in; 
} 

第二种有错误
friend istream& operator >> (istream& in , PetDog<1,2,3,4,5.>& p){
cout<<"[写入宠物信息]"<<endl;
cout<<"序号:"<<endl;
cin>>p.num;
cout<<"种类:"<<endl;
cin>>p.type;
cout<<"年龄(岁)"<<endl;
cin>>p.age;
cout<<"体重(kg)"<<endl;
cin>>p.weight;
cout<<"状态(1为健康,2为生病):"<<endl;
cin>>p.state;
return in;

运行结果及报错内容

第一种报错
33 45 D:\程序\Devc++\宠物医院管理系统.cpp [Error] 'PetDog' has not been declared
33 51 D:\程序\Devc++\宠物医院管理系统.cpp [Error] expected ',' or '...' before '<' token
第二种报错
36 8 D:\程序\Devc++\宠物医院管理系统.cpp [Error] 'p' was not declared in this scope

我的解答思路和尝试过的方法
我想要达到的结果
  • 写回答

2条回答 默认 最新

  • CSDN专家-link 2022-03-03 04:55
    关注

    两种啥区别啊。参数有in,你还用cin输入啊

    评论

报告相同问题?

问题事件

  • 创建了问题 3月2日

悬赏问题

  • ¥50 VS2019,xamarin框架串口调试报错Java.Lang.SecurityException: Exception of type
  • ¥20 QT如何判断QLineF线鼠标划过事件
  • ¥15 关于#phpstorm#的问题:phpstorm编辑工具 光标选中了就会自动复制到粘贴板上 这样我之前复制的内容就失效了
  • ¥15 pychram安装jupyter插件
  • ¥60 悬赏破解越狱iphone4s中360保险箱密码遗忘
  • ¥20 ARKts悬浮窗和快捷方式问题
  • ¥15 linux中nginx服务器提示not found on accelerator,如何解决?(语言-php|操作系统-linux)
  • ¥15 comparecluster没有办法kegg
  • ¥15 远程访问linux主机超时
  • ¥15 odoo17存货管理优势于中国国内该行业传统ERP或MES的详细解读和举例