Exemple #1
0
int main()
{
    FILE *f,*g;
    int cash,time,time1;
    char name[20];
    f=fopen("input.dat","r");
    g=fopen("output.dat","w");
    while (fscanf(f,"%d",&time)==1) AddTime(time);
    while (fscanf(f,"%s",&name)==1)
    {
        fscanf(f,"%d",&cash);
        fscanf(f,"%d",&time);
        AddCustomer(cash,time);
    }
    cash=0;
    time1=0;
    time=0;
    while (FirstTime!=NULL)
    {
        time=time+FirstTime->time-time1;
        while ((FirstCustomer!=NULL) && (time-FirstCustomer->time>=0))
        {
            cash=cash+FirstCustomer->cash;
            time=time-FirstCustomer->time;
            DeleteCustomer();
        }
        time1=FirstTime->time;
        fprintf(g,"After %d seconds: %d\n",FirstTime->time,cash);
        DeleteTime();
    }
    fclose(f);
    fclose(g);
    return 0;
}
Exemple #2
0
 void IncrementTopicCount(int doc_id,
                          int topic,
                          double alpha_k,
                          bool is_general = false) {
   if (!is_general) {
     ++doc2topic_count_[doc_id].first;
     if (alpha_k != 0) {
       AddCustomer(doc_id, topic, alpha_k);
     }
   }
   ++doc2topic_count_[doc_id].second[topic];
 }
void CustomerManagementMain()
{
	for (;;)
	{
		cout << "CURRENTLY IN CUSTOMER MANAGEMENT" << endl;
		cout << "------------" << endl;
		cout << "1) View Customers" << endl;
		cout << "2) Add Customer" << endl;
		cout << "3) Edit Customer" << endl;
		cout << "4) Remove Customer" << endl;
		cout << "5) Quit" << endl;
		cout << "------------" << endl;
		cout << "CHOICE:";

		string Choice;
		getline(cin, Choice);
		system("CLS");
		switch (Choice[0])
		{
		case '1':
			PizzaDB.show("customer");
			break;
		case '2':
			AddCustomer();
			break;
		case '3':
			EditCustomer();
			break;
		case '4':
			RemoveCustomer();
			break;
		case '5':
			return;
			break;
		default:
			cout << "\n\nERROR: CODE 496X: Invalid Command... Please try again.\n\n\n";
			break;
		}
	}
}