smileeFace's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Members
Active Posts:
19 (0.03 per day)
Joined:
05-October 11
Profile Views:
220
Last Active:
User is offline Oct 03 2012 01:50 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   smileeFace has not set their status

Posts I've Made

  1. In Topic: Turning a C++ Console App to Windows App

    Posted 20 Feb 2012

    Time has passed since I posted this topic and I would like to take back. I found Qt SDK and now I am in love. Highly recomend it Qt SDK

    Follow these tutorials to get you started C++ Qt Tutorials

    There is also an insane amount of documentation.

    It is awesome.
  2. In Topic: Initializing array of structs in function with pointer

    Posted 12 Nov 2011

    Fail......

    If it would have been a forgetting a semicolon after something I would have felt a lot better.

    Thanks again Jim.
  3. In Topic: Initializing array of structs in function with pointer

    Posted 12 Nov 2011

    Sorry, forgot to put up the updated class...

    #ifndef DATADISC_H_INCLUDED
    #define DATADISC_H_INCLUDED
    
    #include <fstream>
    #include <vector>
    #include "datadisc.h"
    
    struct TableMinMax
    {
        double min;
        double max;
    };
    
    class DiscriminateInformation
    {
        public:
            void openDataFiles();
    
            void set_LValue_numC_numA();
    
            void setMultipleVectors();
    
            void set_T1();
    
            void set_T2_SA_SO();
    
            void set_ND();
    
            void reCalc_T2_SA_SO();
    
            void LValueOperations();
    
            void openExampleFile();
    
        private:
            std::vector<TableMinMax> pntrT1;
            std::vector<bool>        pntrND;
            std::vector<bool>        pntrUD;
            std::vector<bool>        pntrNUD;
            std::vector<double>      pntrT2;
            std::vector<double>      pntrSO;
            std::vector<double>      pntrSA;
            std::vector<bool>        pntrATU;
            std::vector<bool>        pntrATD;
            std::vector<TableMinMax> pntrT2Classes;
    
            int
                numC,       numA,       T2numC;
    
            double
                LValue;
    
            std::fstream inputData;
            std::fstream outputData;
    
            char
                inDataPath[100],     outDataPath[100];
    
    };
    
    
    #endif // DATADISC_H_INCLUDED
    
    
    
  4. In Topic: Initializing array of structs in function with pointer

    Posted 12 Nov 2011

    Quote

    Where have you implemented these functions? You have defined them in your class but I don't see where you have actually written these functions.

    Jim


    Didn't include it, here it is:

    #include <iostream>
    #include <iomanip>
    #include <cstdlib>
    #include <cmath>
    #include <windows.h>
    #include <fstream>
    #include <vector>
    #include <cstring>
    #include "datadisc.h"
    using namespace std;
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::openDataFiles()
    {
        system("CLS");
    
        cin.clear();
        cin.ignore();
    
        cout << "To be able to open data, be sure that the data file is .txt and\n"
                "that it is saved in the Project folder. The file name\n"
                "must contain no spaces\n\n"
                "Please enter the input file name: ";
    
        cin.getline(inDataPath, sizeof(inDataPath));
    
        inputData.open(inDataPath, ios::in);
    
        while(inputData.fail())
        {
            system("CLS");
            memset(inDataPath,'\0',sizeof(inDataPath));
            cin.clear();
    		cin.ignore();
    
            cout << "Error: Input file failed to open, please check path name and try"
            " again.\n\n";
    
            cout << "Please enter the path to the file where data is stored:\n";
    
            cin.getline(inDataPath, sizeof(inDataPath));
    
            inputData.open(inDataPath, ios::in);
        }
    
    //    cin.clear();
    //    cin.ignore();
    
        cout << "Please enter the output file name: ";
    
        cin.getline(outDataPath, sizeof(outDataPath));
    
        outputData.open(outDataPath, ios::out);
    
        while(outputData.fail())
        {
            system("CLS");
            memset(outDataPath,'\0',sizeof(outDataPath));
            cin.clear();
    		cin.ignore();
    
            cout << "Error: Output file failed to open, please check path name and try"
            "again.\n\n";
    
            cout << "Please enter the path to the file you would like to write to:\n";
    
            cin.getline(outDataPath, sizeof(outDataPath));
    
            outputData.open(outDataPath, ios::out);
        }
    
        cout << "Files opened successfully. Please hit Enter to continue...";
    
    //    system("PAUSE");
    
    //    cin.clear();
    //    cin.ignore();
    
        set_LValue_numC_numA();
    
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::set_LValue_numC_numA()
    {
        /*...Code...*/
    
        setMultipleVectors();
    
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::setMultipleVectors()
    {
        /*...code...*/
        set_T1();
    
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::set_T1()
    {
    
        /*...code...*/
        set_T2_SA_SO();
    
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::set_T2_SA_SO()
    {
        /*...code...*/
    
        set_ND();
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::set_ND()
    {
        /*...code...*/
        reCalc_T2_SA_SO();
        LValueOperations();
    
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::reCalc_T2_SA_SO()
    {
        /*...code....*/
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void DiscriminateInformation::LValueOperations()
    {
        /* ...code...*/
        
        pntrATD.clear();
        pntrATU.clear();
        pntrND.clear();
        pntrNUD.clear();
        pntrSA.clear();
        pntrSO.clear();
        pntrT1.clear();
        pntrT2.clear();
        pntrT2Classes.clear();
        pntrUD.clear();
    
        memset(inDataPath,'\0',sizeof(inDataPath));
        memset(outDataPath,'\0',sizeof(outDataPath));
    
        inputData.close();
        outputData.close();
    
        return;
    }
    
    /****************************************************************************
        -UPDATE ACCORDING TO FUNCTION PURPOSE!-
        Return:
        Parameters:
    ****************************************************************************/
    void openExampleFile()
    {
    
    
        /* This is the only function that isn't linking properly...*/
    
    
    
        system("CLS");
        system("abaloneDatabase.txt");
    
        cout << "The first number on the first line is the Permissible"
             << "Missclassification Value, followed by the number of objects,"
             << "then the number of attributes.\n"
             << "The next lines are the minimum and maximum values in each line"
             << "of each object as the rows and attributes as columns. It is"
             << "ABSOLUTELY CRUCIAL that there is a space between each value."
             << "Else the program will not be able to differentiate between values.\n\n";
    
        system("PAUSE");
    
        return;
    }
    
    



    I don't know if the validation on openDataFiles works yet, I will be working on it today. If I were to comment out openExampleFile here and in the main, the program runs fine.

    I don't know if you have noticed but I thought that I should mention that there are three sepparate files: main.cpp, datadisc.h, and datadisc.cpp.
  5. In Topic: Initializing array of structs in function with pointer

    Posted 11 Nov 2011

    Thanks everyone for your help, I solved all my issues with the help of jimblumberg.

    I made a class and used vectors and the program makes a lot more sense now.

    Now the issue that I am having, from what I have read, are compiler related. I get the error:

    undefined reference to `DiscriminateInformation::openExampleFile|
    ||=== Build finished: 1 errors, 0 warnings ===|
    
    


    openExampleFile
    
    is a member function in my class. For some reason mingw is only giving me trouble with that one.

    baavgai, this is the new code, hope it makes a little more sense. Let me know if there are any other edits so that it is more understandable:

    int main()
    {
        int
            choice;
    
        DiscriminateInformation
            information;
    
        // Prompts user for choice, length due to data validation
        while(choice != 0)
        {
            system("CLS");
    
            std::cout << /* Instructions... */ << endl;
    
            std::cin >> choice;
    
            /***************   MAIN MENU   *************************************************************/
            switch(choice)
            {
                case 1: // Opne Files
                {
                    information.openDataFiles();
                    break;
                }
                case 2:
                {
                    information.openExampleFile();
                    break;
                }
    
            }
            /*******************************************************************************************/
        }
    
        return 0;
    }
    
    


    and the header file:

    #ifndef DATADISC_H_INCLUDED
    #define DATADISC_H_INCLUDED
    
    #include <fstream>
    #include <vector>
    #include "datadisc.h"
    
    struct TableMinMax
    {
        double min;
        double max;
    };
    
    class DiscriminateInformation
    {
        public:
            void openDataFiles();
    
            void set_LValue_numC_numA();
    
            void setMultipleVectors();
    
            void set_T1();
    
            void set_T2_SA_SO();
    
            void set_ND();
    
            void reCalc_T2_SA_SO();
    
            void LValueOperations();
    
            void openExampleFile();
    
        private:
            std::vector<TableMinMax> pntrT1;
            std::vector<bool>        pntrND;
            std::vector<bool>        pntrUD;
            std::vector<bool>        pntrNUD;
            std::vector<double>      pntrT2;
            std::vector<double>      pntrSO;
            std::vector<double>      pntrSA;
            std::vector<bool>        pntrATU;
            std::vector<bool>        pntrATD;
            std::vector<TableMinMax> pntrT2Classes;
    
            int
                numC,       numA,       T2numC;
    
            double
                LValue;
    
            std::fstream inputData;
            std::fstream outputData;
    
            char
                inDataPath[100],     outDataPath[100];
    
    };
    
    #endif // DATADISC_H_INCLUDED
    
    


    Time for a couple of pints. Cheers.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
1
Programming Languages:
C/C++

Contact Information

E-mail:
Private

Friends

smileeFace hasn't added any friends yet.

Comments

smileeFace has no profile comments yet. Why not say hello?