Mọi người cho em hỏi em làm như này sao nó cứ báo lỗi vậy ạ
Đề là thiết kế và xây dựng phần mềm chuyển đổi file dữ liệu sang dạng Morse code và ngược lại
nó cứ ghi là in function int main
#include <iostream>
#include <string>
#include <cctype>
static const std::string characterSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ;
static const std::string morseCodeSymbol[] =
{"._" ,"_..." ,"_._." ,"_.." ,"." ,".._."
,"__." ,"...." ,".." ,".___" ,"_._" ,"._.."
,"__" ,"_." ,"___" ,".__." ,"__._" ,"._."
,"..." ,"_" ,".._" ,"..._" ,".__" ,"_.._"
,"_.__" ,"__.." ,".____" ,"..___" ,"...__" ,"...._"
,"....." ,"_...." ,"__..." ,"___.." ,"____." ,"_____" };
class MorseCodeSystem
{
private :
std::string stringCode;
public :
//conversion constructor
MorseCodeSystem(std::string ss)
{
stringCode = ss;
}
friend std::istream &operator >> (std::istream &iss, MorseCodeSystem &rhs)
{
std::getline(iss,rhs.stringCode);
return iss;
}
void EncodeStringToMorseSymbol();
};
inline void MorseCodeSystem::EncodeStringToMorseSymbol()
{
char character;
std::string ss= "" ;
for(int x=0; x<= stringCode.length() - 1; x++)
{
for(int y=0; y <= 35; y++)
{
character = toupper(stringCode[x]);
if(character == characterSet[y])
{
ss += morseCodeSymbol[y];
ss += "|";
}}}
std::cout << ss;
}
int main()
{
MorseCodeSymbol my_string("SINH VIEN DO GIA TUAN CONG MSSV 20192188");
my_string.EncodeStringToMorseSymbol();
return 0;
}