C ++ Code :: morsecode ()에 대한 정의되지 않은 참조 및 Code :: alphacode ()에 대한 정의되지 않은 참조

KMM

이 오류 발생 Code :: morsecode ()에 대한 정의되지 않은 참조 Code :: alphacode ()에 대한 정의되지 않은 참조 : 오류 : ld에서 1 개의 종료 상태를 반환했습니다.

C ++ morsecode.cpp를 사용하여 컴파일했습니다. 나는 문제가 무엇인지 알아낼 수 없다 ?? 내 코드를 살펴보고 문제가 어디에 있는지 확인했지만 문제가 무엇인지 파악할 수 없습니다. 도움을 주시면 감사하겠습니다. 감사

#include <string>
#include <vector>
#include <iostream>

using namespace std;

class Code
{
public:
Code();         //Default Constructor

string decode(vector<string> message);  //Decodes message
private:
vector<string> codewords;   //codeword vector parallel to A-Z

vector<char> alpha;     //this is the vector for A-Z    

vector<char> alphacode();   //Function that builds the vector alpha -A B C...

vector<string> morsecode(); //function builds the vector codewords containing                         morsecode

char decode(string c);      //returns the character for the codeword c.
};

Code::Code()
{
codewords = morsecode();
alpha = alphacode();
}

string Code::decode(vector<string> message)
{
string temp;
for(int i = 0; i < message.size(); i++)
{
  temp += decode(message[i]);
}   
return temp;
}

char Code::decode(string c)
{
for(int i = 0; i < alpha.size(); i++)
{
  if(c == codewords[i])
  {
    return alpha[i];
  }
}
}



// This function returns a vector containing the morse code
vector<string> morsecode()
{ 
 vector<string> temp(28);
 temp[0] =".-";
 temp[1] ="-...";
 temp[2] ="-.-.";
 temp[3] ="-..";
 temp[4] =".";
 temp[5] ="..-.";
 temp[6] ="--.";
 temp[7] ="....";
 temp[8] ="..";
 temp[9] =".---";
 temp[10] ="-.-";
 temp[11] =".-..";
 temp[12] ="--";
 temp[13] ="-.";
 temp[14] ="---";
 temp[15] =".--.";
 temp[16] ="--.--";
 temp[17] =".-.";
 temp[18] ="...";
 temp[19] ="-";
 temp[20] ="..-";
 temp[21] ="...-";
 temp[22] =".--";
 temp[23] ="-..-";
 temp[24] ="-.--";
 temp[25] ="--..";
 temp[26] =".......";
 temp[27] ="x";
 return temp;
}

// This returns a vector containing the alphabet a-z and " "
vector<char> alphacode()
{
 vector<char> temp;
 for (char c='A'; c<='Z'; c++)
  temp.push_back(c);
  temp.push_back(' ');
  temp.push_back('.');
 return temp;
}

//Main Program
int main()
{
vector<string> message;
string temp;
Code c;

cin >> temp;

while (cin.good())
{
  message.push_back(temp);
  cin >> temp;
}

cout << c.decode(message) << endl;

return 0;
}
Eljay

정의 된 독립형 기능 vector<string> morsecode()이 바람직하지 않습니다 vector<string> Code::morsecode().

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

TOP 리스트

  1. 1

    JNDI를 사용하여 Spring Boot에서 다중 데이터 소스 구성

  2. 2

    std :: regex의 일관성없는 동작

  3. 3

    JSoup javax.net.ssl.SSLHandshakeException : <url>과 일치하는 주체 대체 DNS 이름이 없습니다.

  4. 4

    PrematureCloseException : 연결이 너무 일찍 닫혔습니다.

  5. 5

    Xcode10 유효성 검사 : 이미지에 투명성이 없지만 여전히 수락되지 않습니까?

  6. 6

    정점 셰이더에서 카메라에서 개체까지의 XY 거리

  7. 7

    Ionic 2 로더가 적시에 표시되지 않음

  8. 8

    Seaborn에서 축 제목 숨기기

  9. 9

    C #에서 'System.DBNull'형식의 개체를 'System.String'형식으로 캐스팅 할 수 없습니다.

  10. 10

    복사 / 붙여 넣기 비활성화

  11. 11

    ArrayBufferLike의 typescript 정의의 깊은 의미

  12. 12

    Google Play Console에서 '예기치 않은 오류가 발생했습니다. 나중에 다시 시도해주세요. (7100000)'오류를 수정하는 방법은 무엇입니까?

  13. 13

    Kubernetes Horizontal Pod Autoscaler (HPA) 테스트

  14. 14

    jfreecharts에서 x 및 y 축 선을 조정하는 방법

  15. 15

    PRNG 기간보다 순열이 더 많은 목록을 무작위로 섞는 방법은 무엇입니까?

  16. 16

    C # HttpWebRequest 기본 연결이 닫혔습니다. 전송시 예기치 않은 오류가 발생했습니다.

  17. 17

    다음 컨트롤이 추가되었지만 사용할 수 없습니다.

  18. 18

    잘못된 구성 개체입니다. Webpack이 Angular의 API 스키마와 일치하지 않는 구성 개체를 사용하여 초기화되었습니다.

  19. 19

    Android Kotlin은 다른 활동에서 함수를 호출합니다.

  20. 20

    R의 마침표와 숫자 사이에 문자열 삽입

  21. 21

    Assets의 BitmapFactory.decodeStream이 Android 7에서 null을 반환합니다.

뜨겁다태그

보관