ошибка C2664 char [80] to char

Привет, я должен создать программу для чтения файла .txt и сохранения информации в txt в структуру и перечисление (необходимо использовать перечисление как обязательное), а затем распечатать информацию после перестановки слов. например
Сара
Страна чудес
Весы 2 - 10 - 1993
3
Я хочу...
Надеюсь...
............

TO

Меня зовут сара
моя национальность страна чудес
мой день рождения 2 октября 1993 года
я весы

у меня есть 3 желания
1. я хочу к...
2. Я надеюсь...
3. ............

Я столкнулся с аналогичной ошибкой C2664 для getHoroNum и checkHoro, заявив, что он не может преобразовать параметр 1 из «char [80]» в «char». Пожалуйста помоги! Заранее большое спасибо!

    #include <iomanip>
    #include <iostream>
    #include <cstdlib>
    #include <ctime>
    #include <cctype>
    #include <fstream>
    #include <string>

    using namespace std;

    const int MAX = 80;
    const int MAXNO = 10;

    enum Zodiac 
    {
        Aquarius, Pisces, Aries, Taurus,
        Gemini, Cancer, Leo, Virgo,
        Libra, Scorpio, Sagittarius, Capricorn
    };
    struct Date
    {
        Zodiac sign;
        int day;
        int month;
        int year;
    };
    struct Student
    {
        char name [MAX];
        char nationality [MAX];
        Date birthDate;
        int no; // no of other messages
        char wishMessage [MAXNO][MAX];

    };

    void myInfo (fstream&, char [], Student&);
    // The above function reads information from the text file
    // and store the information in a structure reference parameter

    void printOut(Student , char[], char[]);
    void getHoroNum(char , Student&);
    void checkHoro (char , Student);
    void getMth (int, char []) ;

    int main()
    {
        fstream infile;
        char fName[MAX];
        char horo [MAX];
        char fHoro[MAX];
        char mth[MAX];
        int month;
        Student info;
        cout << "Enter your info file name: ";
        cin  >> fName; 
        cout << endl;

        month = info.birthDate.month;

        myInfo(infile, fName, info);
        getHoroNum(horo, info);
        checkHoro(fHoro, info);
        getMth(month, mth);

        printOut(info, );

    }

    void myInfo (fstream& infile, char fName[], Student& info)
    {
        infile.open(fName, ios::in);
        char temp[MAX];
        char horo[MAX];

        if(!infile)
        {
            cout << "Error file not found!" << endl;
            exit(0);
        }
        infile.getline(info.name, MAX);
        infile.getline(info.nationality,MAX);
        infile  >> horo
            >> info.birthDate.day
            >> temp
            >> info.birthDate.month
            >> temp
            >> info.birthDate.year;
            infile  >> info.no;
        for(int i=0; i < info.no ;i++)
        {
            infile.getline(info.wishMessage[i], MAX);
        }
        infile.close();
        cout << "Successfully readed!" << endl;

    }

    void getHoroNum(char horo[], Student& info)
    {
        if (strcmp (horo,"Aquarius"))
        {
            info.birthDate.sign = Aquarius;
        }
        else if (strcmp(horo,"Pisces"))
        {
            info.birthDate.sign = Pisces;
        }
        else if (strcmp(horo,"Aries"))
        {
            info.birthDate.sign = Aries;
        }
        else if (strcmp(horo,"Taurus"))
        {
            info.birthDate.sign = Taurus;
        }
        else if (strcmp(horo,"Gemini"))
        {
            info.birthDate.sign = Gemini;
        }
        else if (strcmp(horo,"Cancer"))
        {
            info.birthDate.sign = Cancer;
        }
        else if (strcmp(horo,"Leo"))
        {
            info.birthDate.sign = Leo;
        }
        else if (strcmp(horo,"Virgo"))
        {
            info.birthDate.sign = Virgo;
        }
        else if (strcmp(horo,"Libra"))
        {
            info.birthDate.sign = Libra;
        }
        else if (strcmp(horo,"Scorpio"))
        {
            info.birthDate.sign = Scorpio;
        }
        else if (strcmp(horo,"Sagittarius"))
        {
            info.birthDate.sign = Sagittarius;
        }
        else if (strcmp(horo,"Capricorn"))
        {
            info.birthDate.sign = Capricorn;
        }
    }

    void checkHoro (char fHoro[], Student info)
    {
        if (info.birthDate.sign == Aquarius)
        {
            fHoro = "Aquarius";
        }
        else if (info.birthDate.sign == Pisces)
        {
            fHoro = "Pisces";
        }
        else if (info.birthDate.sign == Aries)
        {
            fHoro = "Aries";
        }
        else if (info.birthDate.sign == Taurus)
        {
            fHoro = "Taurus";
        }
        else if (info.birthDate.sign == Gemini)
        {
            fHoro = "Gemini";
        }
        else if (info.birthDate.sign == Cancer)
        {
            fHoro = "Cancer";
        }
        else if (info.birthDate.sign == Leo)
        {
            fHoro = "Leo";
        }
        else if (info.birthDate.sign == Virgo)
        {
            fHoro = "Virgo";
        }
        else if (info.birthDate.sign == Libra)
        {
            fHoro = "Libra";
        }
        else if (info.birthDate.sign == Scorpio)
        {
            fHoro = "Scorpio";
        }
        else if (info.birthDate.sign == Sagittarius)
        {
            fHoro = "Sagittarius";
        }
        else if (info.birthDate.sign == Capricorn)
        {
            fHoro = "Capricorn";
        }
    }

    void getMth (int month, char mth[] )
    {
        switch (month)
        {
            case 1:
        {
            mth = "January";
            break;
        }

            case 2:
        {
            mth = "February";
            break;
        }
            case 3:
        {
            mth = "March";
            break;
        }
            case 4:
        {
            mth = "April";
            break;
        }
            case 5:
        {
            mth = "May";
            break;
        }
            case 6:
        {
            mth = "June";
            break;
        }
            case 7:
        {
            mth = "July";
            break;
        }
            case 8:
        {
            mth = "August";
            break;
        }

            case 9:
        {
            mth = "September";
            break;
        }
            case 10:
        {
            mth = "October";
            break;
        }
            case 11:
        {
            mth = "November";
            break;
        }
            case 12:
        {
            mth = "December";
            break;
        }

        }
    }

    void printOut(Student info, char mth[], char fHoro[])
    {
        cout << "My name is " << info.name << endl;
        cout << "My nationality is " << info.nationality << endl;
        cout << "My date of birth is " << info.birthDate.day 
             << " " << mth << " " 
             << info.birthDate.year << endl;
        cout << "I am a" << fHoro << endl;
        cout << "\nI have " << info.no << " wishes:" << endl;
        for(int i=0; i < info.no ;i++)
        {
            cout << i << ". " << info.wishMessage[i];
        }
    }

person Isabella Chan    schedule 07.04.2014    source источник
comment
Вы объявили getHoroNum как void getHoroNum(char , вместо void getHoroNum(char[] ,   -  person Iosif Murariu    schedule 07.04.2014
comment
Как и другие ошибки, которые уже были указаны, вам нужно изменить все ваши strcmp тесты, так как логика инвертирована (strcmp возвращает 0, когда строки совпадают). Поэтому измените: if (strcmp (horo,"Aquarius")) на: if (strcmp (horo,"Aquarius") == 0) и так далее...   -  person Paul R    schedule 07.04.2014
comment
Кстати, ваша программа могла бы быть написана намного элегантнее.   -  person Jabberwocky    schedule 07.04.2014
comment
Большое спасибо за помощь! Извините за ошибки.   -  person Isabella Chan    schedule 07.04.2014


Ответы (1)


У вас есть это определение функции:

void getHoroNum(char horo[], Student& info)

и прежде чем у вас будет это объявление:

void getHoroNum(char , Student&);

последний следует заменить на:

void getHoroNum(char* , Student&);
person Jabberwocky    schedule 07.04.2014
comment
Большое спасибо! Наконец-то я могу получить какой-то результат, извините за допущенные глупые ошибки! ›.‹ - person Isabella Chan; 07.04.2014