我正在尝试编写大学作业编码,似乎编译时出现问题,我已经对错误进行了Google搜索,并且我看到的修复程序与我的代码无关.我很感激你的帮助.
以下是错误代码:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall user::user(void)" (??0user@@QAE@XZ)
referenced in function "void __cdecl `dynamic initializer for 'player''(void)" (??__Eplayer@@YAXXZ)
C:\Users\obinyans\Documents\Visual Studio 2010\Projects\test\test\Challenge 1.obj
Run Code Online (Sandbox Code Playgroud)
以下是我的代码的副本:
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
void storeinfo() ;
void showinfo() ;
class user
{
string firstname, lastname, currentteam, position, status ;
int age ;
public:
user();
user(string, string, string, string, string, int) ;
void setFirstName(string fname)
{firstname = fname;}
void setLastName(string lname)
{lastname = lname;}
void …Run Code Online (Sandbox Code Playgroud) 我有一个线性搜索算法设置来搜索它工作的类对象数组但是输出不匹配,当我在数组中搜索一个特定的名称时,找到数组中的第一个和第三个值,但第二个值是未找到..
以下是我的代码谢谢你的帮助.
int linsearch(string val)
{
for (int j=0; j <= 3; j++)
{
if (player[j].getLastName()==val)
return j ;
}
return 1 ;
}
void showinfo()
{
string search;
int found ;
cout << "Please Enter The Player's Last Name : " ;
cin >> search ;
found=linsearch(search);
if (found==1)
{
cout << "\n There is no player called " << search ;
}
else
{
cout << "\n First Name : " << player[found].getFirstName() << "\n" << "Last Name …Run Code Online (Sandbox Code Playgroud)