Ejemplo n.º 1
0
int main(int argc, char const *argv[])
{
	importIrisData("../iris.data");

	cv::Mat iris_data_mat = cv::Mat(4, iris_data.size(), CV_32FC1);
	cv::Mat iris_label_mat = cv::Mat(1, iris_type.size(), CV_32FC1);	

	for(int i=0; i<iris_data.size(); i++){
		iris_data_mat.at<float>(0, i) =	iris_data[i][0];
		iris_data_mat.at<float>(1, i) =	iris_data[i][1];
		iris_data_mat.at<float>(2, i) =	iris_data[i][2];
		iris_data_mat.at<float>(3, i) =	iris_data[i][3];						
		iris_label_mat.at<float>(0, i) = iris_type[i];
	}

	centration(iris_data_mat);
	centration(iris_label_mat);

	std::cout << iris_data_mat << std::endl;
	std::cout << iris_label_mat << std::endl;	

	CCA cca(iris_data_mat, iris_label_mat);
	std::cout << "calc" << std::endl;
	cca.calc();

	for(int i=0; i<iris_data.size(); i++){
		cv::Mat pre = cca.predict(iris_data_mat.col(i));
		std::cout << "true: " << iris_type[i] << " predict: " << pre.at<float>(0, 0) << std::endl;
	}

	return 0;
}
main()
{
    char option;
    AbstractPizza* ap1;
    while( option != 'n' )
    {
        order o2;
        o2.incrementordernumber();
        o2.menu();
        int choice;
        cout<<"\n\t\t********ORDER NUMBER:\t"<<o2.returnordernumber()<<"**********\n";
        choice=5;
        while(!(choice>=1 && choice<=4))
            {
                cout<<"\nPlease Enter Your Choice between 1 & 4:\t\t";
                cin>>choice;
            }
            switch(choice)
            {
        case(1):
                ap1= new ChickenTikkaPizza;
        break;
        case(2):
                ap1= new BeefRoastPizza;
        break;
        case(3):
                ap1= new FourSeasonPizza;
        break;
        case(4):
                ap1= new HawiianPizza;
        break;
        }
        o2.inputperson();
        char choice2='l';
              
        do
        {
            cout<<"\nPlease enter c to pay via credit card and p to pay via cash:\t";
            fflush(stdin);
            cin>>choice2;
        }
        while(!(choice2=='c' || choice2=='p'));
        if(choice2=='c')      
        {
            o2.c1input();
            creditcard cca(12, 2004, 1111222);
            creditcard ccb(12, 2004, 1234567);
            creditcard ccc(12, 2004, 9876543);
            creditcard ccd(12, 2004, 1212121);
            system("cls");
            if( ( o2.comparecredit(cca) || o2.comparecredit(ccb) || o2.comparecredit(ccc) || o2.comparecredit(ccd) ) && ( o2.returnc1size() >= ap1->returnprice() ) )
            {
                cout<<"\n\n\n\n\n\n****Your Account Balance\t"<<o2.returnc1size()<<"\n****Your Order Cost\t\t"<<ap1->returnprice()<<"\n****Balance after transaction\t"<<o2.returnc1size()-ap1->returnprice() ;
                ap1->bake();
            }
            else
            {
                if(!( o2.comparecredit(cca) || o2.comparecredit(ccb) || o2.comparecredit(ccc) || o2.comparecredit(ccd) ))
                cout<<"\n\n\n\n\n\nINVALID CREDIT CARD NUMBER , ORDER COULD NOT BE PROCESSED";
                else if(! ( o2.returnc1size() >= ap1->returnprice() ) )
                cout<<"\n\n\n\n\n\nINSUFFICIENT FUNDS , ORDER COULD NOT BE PROCESSED";
            }
        }
        else
            cout<<"\nThanks for paying by CASH";
        choice2='l';
        o2.displayperson();
        fflush(stdin);
        option=getch();
    }
    delete ap1;
    return 0;
}