• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Ticket类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Ticket的典型用法代码示例。如果您正苦于以下问题:C++ Ticket类的具体用法?C++ Ticket怎么用?C++ Ticket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Ticket类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: compare

      //! Compare another ticket with this object.
      //! Only interface and destination are compared.
      //! @return true if tickets hold same basic information,
      //! false otherwise.
      bool
      compare(const Ticket ticket)
      {
        if (m_ticket.interface == ticket.getInterface() &&
            m_ticket.destination == ticket.getDestination())
          return true;

        return false;
      }
开发者ID:LSTS,项目名称:dune,代码行数:13,代码来源:Ticket.hpp


示例2: getTicket

Ticket* OTicketDAO::getTicket(int id)
{
	for(int i =0; i < tickets.size(); i++)
	{
		Ticket* temp = tickets.at(i);
		if(temp->getTicketID() == id)
			return temp;
	}
	return 0;
}
开发者ID:Musilitar,项目名称:SoccerService,代码行数:10,代码来源:OTicketDAO.cpp


示例3: getPositie

//Geeft de positie van een element in de array; Enkel noodzakelijk om de database te simuleren
int OTicketDAO::getPositie(int id)
{
	for(int i = 0; i < tickets.size(); i++)
	{
		Ticket* temp = tickets.at(i);
		if(temp->getTicketID() == id)
			return i;
	}
	return -1;
}
开发者ID:Musilitar,项目名称:SoccerService,代码行数:11,代码来源:OTicketDAO.cpp


示例4: Lotto

Ticket Lotto(int Tot, int Ran) { // generate and return randomized & sorted array of lottery numbers
    Ticket temp; // create a ticket that will be returned once generated with random lottery numbers with respect to arguments passed to function
    int i = 0;

    if (Tot < 5) { // check for the first argument passed to function
        cout << "Invalid number range, resetting to default: [1-5]" << endl; // if range of lottery number max is below 5, change it to min allowed - 5
        Tot = 5;
    }

    if (Ran < 2) { // check the second argument, if less than 2, set it to default value of 2, we need at least 2 winning numbers to play with
        cout << "Invalid ticket request, setting number of winning numbers to default - 2." << endl;
        Ran = 2;
    }

    for (i = 0; i < Tot; i++) // generate non-random sequence of numbers from 1 to Tot and store it in vector<int> array
        temp.push_back(i+1);

    for (i = 0; i < Ran; i++) // shuffle the numbers "Ran" many times to have better randomization of numbers
        random_shuffle(temp.begin(), temp.end());

    temp.erase(temp.begin()+Ran, temp.end()); // erase unnecessary numbers from Ran+, numbers from 1 to Ran are kept in.
    sort(temp.begin(), temp.end()); // finally, sort the numbers

    return temp; // and return the sorted and randomized array
}
开发者ID:marcialwushu,项目名称:C---Primer-Plus-Exercises-Solutions,代码行数:25,代码来源:main.cpp


示例5:

vector<Ticket*> OTicketDAO::vindTicketDoorID(int ID)
{
	vector<Ticket*> results = vector<Ticket*>();
	for(int i =0; i < tickets.size(); i++)
	{
		Ticket* temp = tickets.at(i);
		if(temp->getTicketID() == ID)
			results.push_back(temp);
	}
	return results;
}
开发者ID:Musilitar,项目名称:SoccerService,代码行数:11,代码来源:OTicketDAO.cpp


示例6: lk

Status TransportLayerLegacy::_runTicket(Ticket ticket) {
    if (!_running.load()) {
        return TransportLayer::ShutdownStatus;
    }

    if (ticket.expiration() < Date_t::now()) {
        return Ticket::ExpiredStatus;
    }

    AbstractMessagingPort* amp;

    {
        stdx::lock_guard<stdx::mutex> lk(_connectionsMutex);

        auto conn = _connections.find(ticket.sessionId());
        if (conn == _connections.end()) {
            return TransportLayer::TicketSessionUnknownStatus;
        }

        // "check out" the port
        conn->second.inUse = true;
        amp = conn->second.amp.get();
    }

    auto legacyTicket = checked_cast<LegacyTicket*>(getTicketImpl(ticket));
    auto res = legacyTicket->_fill(amp);

    {
        stdx::lock_guard<stdx::mutex> lk(_connectionsMutex);

        auto conn = _connections.find(ticket.sessionId());
        invariant(conn != _connections.end());

#ifdef MONGO_CONFIG_SSL
        // If we didn't have an X509 subject name, see if we have one now
        if (!conn->second.sslPeerInfo) {
            auto info = amp->getX509PeerInfo();
            if (info.subjectName != "") {
                conn->second.sslPeerInfo = info;
            }
        }
#endif
        conn->second.inUse = false;

        if (conn->second.ended) {
            Listener::globalTicketHolder.release();
            _connections.erase(conn);
        }
    }

    return res;
}
开发者ID:mihail812,项目名称:mongo,代码行数:52,代码来源:transport_layer_legacy.cpp


示例7: while

    bool  ListenerSSL::_checkHalt(void)
    {
      while (this->_th->TryGet())
	{
	  Ticket  *t = this->_th->CurTicket;
	  if (t->GetAction() == CORE_HALT_MODULE)
	    {
	      this->_th->Drop("CORE", CORE_HALTED_MODULE);
	      return (true);
	    }
	}
      return (false);
    }
开发者ID:nicolascormier,项目名称:ncormier-academic-projects,代码行数:13,代码来源:ListenerSSL.cpp


示例8: loadInfoTicket

void formUpdBug::loadInfoTicket(Ticket source)
{

idTk = source.getIdTicket();
    ui->titleTicket->setText(source.getNameTicket());
    ui->description->setText(source.getDescrTicket());
    ui->dateCrea->setDateTime(QDateTime::fromString(source.getCreateDt(),"yyyy-MM-ddTHH:mm:ss"));
    ui->dateAssign->setDateTime(QDateTime::fromString(source.getSetUserDate(),"yyyy-MM-ddTHH:mm:ss"));
    ui->dateEnd->setDateTime(QDateTime::fromString(source.getEndDate(),"yyyy-MM-ddTHH:mm:ss"));
    ui->etatComboBox->setCurrentIndex(ui->etatComboBox->findText(source.getEtat()));
    ui->usrComboBox->setCurrentIndex(ui->usrComboBox->findText(source.getDev()));
    ui->createComboBox->setCurrentIndex(ui->createComboBox->findText(source.getCreateName()));


}
开发者ID:workspacerg,项目名称:Juntos,代码行数:15,代码来源:formupdbug.cpp


示例9: on_save_clicked

void formUpdBug::on_save_clicked()
{
    Ticket bug;

    bug.setIdTicket(idTk);
    bug.setNameTicket(ui->titleTicket->text());
    bug.setDescrTicket(ui->description->toPlainText());
    bug.setCreateName(ui->createComboBox->currentText());
    bug.setDev(ui->usrComboBox->currentText());
    bug.setEtat(ui->etatComboBox->currentText());

    emit save_upd_ticket(bug);

}
开发者ID:workspacerg,项目名称:Juntos,代码行数:14,代码来源:formupdbug.cpp


示例10: while

Ticket Cine::ingresarASalaC(Sala s, const Ticket &t){
    Lista<pair<Sala, int> > es=espectadores_;
    int i=0;
    int se=0;
    while (i<es.longitud()) {
        if (((es.iesimo(i)).first)==s) {
        se=i;
        }
        i++;
    }

    espectadores_.agregarAtras(make_pair(s,espectadoresC(s)+1));
    espectadores_.sacar(es.iesimo(se));
    ticketsVendidos_.eliminarPosicion(ticketsVendidos_.posicion(t));
    Pelicula p=t.peliculaT();
    Ticket res=Ticket(p,s,true);
    return res;
}
开发者ID:Karamchi,项目名称:Algo1_2_3_Cosas_Viejas,代码行数:18,代码来源:cine.cpp


示例11: catch

Status TransportLayerLegacy::_runTicket(Ticket ticket) {
    if (!_running.load()) {
        return TransportLayer::ShutdownStatus;
    }

    if (ticket.expiration() < Date_t::now()) {
        return Ticket::ExpiredStatus;
    }

    // get the weak_ptr out of the ticket
    // attempt to make it into a shared_ptr
    auto legacyTicket = checked_cast<LegacyTicket*>(getTicketImpl(ticket));
    auto session = legacyTicket->getSession();
    if (!session) {
        return TransportLayer::TicketSessionClosedStatus;
    }

    auto conn = session->conn();
    if (conn->closed) {
        return TransportLayer::TicketSessionClosedStatus;
    }

    Status res = Status::OK();
    try {
        res = legacyTicket->fill(conn->amp.get());
    } catch (...) {
        res = exceptionToStatus();
    }

#ifdef MONGO_CONFIG_SSL
    // If we didn't have an X509 subject name, see if we have one now
    auto& sslPeerInfo = SSLPeerInfo::forSession(legacyTicket->getSession());
    if (sslPeerInfo.subjectName.empty()) {
        auto info = conn->amp->getX509PeerInfo();
        if (!info.subjectName.empty()) {
            sslPeerInfo = info;
        }
    }
#endif

    return res;
}
开发者ID:DINKIN,项目名称:mongo,代码行数:42,代码来源:transport_layer_legacy.cpp


示例12: lock

void SiriTokenProvider::PushBackTicket( const Ticket& t,bool bLock)
{
    if(t.IsExpired())
        return;
    if(bLock)
    {
        FastMutex::ScopedLock lock(_mutex_tickets);
        list<string>::iterator it=std::find(assistant_in_uses.begin(),assistant_in_uses.end(),t.assistantId);
        list<Ticket>::iterator itr=std::find(g_tickets.begin(),g_tickets.end(),t);
        if((itr==g_tickets.end()) && (it==assistant_in_uses.end()))
        {
            g_tickets.push_back(t);
        }
    }
    else
    {
        list<string>::iterator it=std::find(assistant_in_uses.begin(),assistant_in_uses.end(),t.assistantId);
        list<Ticket>::iterator itr=std::find(g_tickets.begin(),g_tickets.end(),t);
        if((itr==g_tickets.end()) && (it==assistant_in_uses.end()))
        {
            g_tickets.push_back(t);
        }
    }
}
开发者ID:CDTeam,项目名称:Siri-Proxy,代码行数:24,代码来源:SiriTokenProvider.cpp


示例13: debug

void UserProcessingCenter::handleKerberosLogin(CMazeMsg* context)
{
    //cout<<":: kerberos login:: "<<endl;
    debug("kerberos login request");
	char *pbuf = context->getMsg();
	int rt = context->getLen();
	MBlockSocket *pclient = context->getSocket();
	UserDatabase *userdb = UserDatabase::getInstance();

	KMsgHead kmsghead;
	if(kmsghead.unserialize(pbuf,rt)!=-1)
	{
		switch(kmsghead.msgtype)
		{
			case USER_LOGIN_REQUEST:
			{
				//cout<<"::kerberos login::"<<endl;
				UserLoginRequest  req;
				if(req.unserialize(pbuf,rt)!=-1)
				{
					USERDB	*userinfo = new USERDB;

					//debug("recv req from user %d to  @time %d"<<req.uid<<"  "<<req.ts);

					bool logfind=false;

					if(req.uid!=0)
					{
                    	debug("recv req from user id to  @time--->"<<req.uid<<"  "<<req.ts);

						logfind=(userdb->get_record( req.uid,userinfo) == 0);
						debug("find user %d 's user info"<<req.uid);
					}
					else
					{
	                    debug("recv req from user email to  @time---->"<<req.emailAddr<<"  "<<req.ts);

						string emailAddr=req.emailAddr;
						string badEmail = string("[email protected]");
						if(emailAddr == badEmail)
						{
							cout<<"--------bad email--------"<<endl;
							logfind = false;
							
						}
						else
						{
							logfind=(userdb->get_record(emailAddr,userinfo) == 0);
							debug("find user %s 's user info"<<emailAddr.c_str());
						}
					}


					if(logfind)
					{
						//generate ticket and send it back to User here...
						UserLoginReply reply;
						strncpy(reply.userInfo.NickName,userinfo->NickName,24);
						strncpy(reply.userInfo.MailAddr,userinfo->MailAddr,128);
						reply.userInfo.UID=userinfo->UID;
						reply.userInfo.IP=pclient->GetPeerName().GetIP();	//TODO
						reply.userInfo.ServerPort=pclient->GetPeerName().GetPort();	//TODO
						reply.userInfo.Account=userinfo->Account;
						reply.userInfo.Level=userinfo->Level;
						reply.userInfo.LastAccountAddTime=(unsigned)userinfo->LastAddAccount;

						//get user password(key) from user database;
						string userKey=userinfo->Pwd;
						//get tgs key from config or database.
						string tgsKey ="tgskey";
						//generate a random string to be the session key shared by user and tgs.
						string sessionKey=GenRandomKey();

						unsigned ts=(unsigned)time(NULL);//the time-stamp of the ticket release.

						reply.ts   =ts;
						reply.life =TGS_TICKET_LIFE;//the life of the ticket below
						reply.privilege=0;//TODO privilege of user..
						reply.head.src=0;
						reply.head.dst=req.uid;
						reply.head.status=0;

						reply.sessionKey.set(sessionKey.c_str(),sessionKey.length());

						Ticket ticket;
						ticket.uid=req.uid;
						ticket.uaddr=0;	//TODO
						ticket.ts=ts;
						ticket.life=TGS_TICKET_LIFE;
						ticket.privilege=0;//TODO; 
						ticket.sessionKey.set(sessionKey.c_str(),sessionKey.length());

						reply.cipheredTicket=ticket.serializeAndEncrypt(tgsKey.c_str(),tgsKey.length());
						RawData result=reply.serializeAndEncrypt(userKey.c_str(),userKey.length());

						debug("AS:\tGrant ticket and session key {%s} to user %d\n"<<sessionKey.c_str()<<req.uid);
						unsigned int ip = pclient->GetPeerName().GetIP();
						string ip_str=pclient->GetPeerName().ip();
						pclient->SendPacket(result.data,result.len);

//.........这里部分代码省略.........
开发者ID:IthacaDream,项目名称:Test,代码行数:101,代码来源:UserProcessingCenter.cpp


示例14: main

int main() {

    int lotMaxR, winN, matchingN = 0; // lotMaxR = max range number for lottery numbers to be drawn, from 1 to lotMaxR

    do {
        cout << "Enter lottery range, from 1 to (5 or greater): "; // ask to input maximum range of possible lottery draw number
    } while(cin >> lotMaxR && lotMaxR < 5); // get proper number from user until 5 or more is entered

    do {
        cout << "Enter how many numbers to draw (2 or greater): "; // ask for how many spots on the lotto card or winning numbers to draw in lottery play
    } while(cin >> winN && winN < 2);  // ask for input until 2 or number is entered

    Ticket winners = Lotto(lotMaxR,winN); // generate random numbers  for winning numbers
    Ticket myticket = Lotto(lotMaxR,winN); // generate random numbers for user's playing ticket, something like QuickPick

    cout << "Winning numbers: ";
    DisplayTicket(winners); // display winning numbers
    cout << "Your ticket numbers: ";
    DisplayTicket(myticket); // display playing user's numbers

    cout << "Number(s) matched on your ticket: "; // display matching numbers from both arrays (lottery drawn numbers and user's quick pick)
    for (int i = 0; i < winN; i++)
        if (find(winners.begin(), winners.end(), myticket[i]) != winners.end()) { // compare each winning number to user's picked numbers
            cout << myticket[i] << " "; // if matched, display the number
            matchingN++; // and increase the number of matched numbers
        }

        if (matchingN == 0) // if no numbers were matched display the message
            cout << "None" << endl;
        else
            cout << endl;

        if (matchingN == winN && matchingN > 5) // if all winning numbers guessed correctly and the total number of them is 6 or more - almost impossible win, display epic congratulations message!
            cout << "You've guessed all numbers!!! BEER IS ON ME!";
        else if (matchingN == winN && matchingN == 2 ) // special occasion: if out of 2 winning numbers 2 guessed correctly, display FREE ticket prize msg
            cout << "Congratulations, you've won min 2x2 game! Prize: 10 FREE tickets!" << endl;
        else if (matchingN > 5) // display messages for each number of correctly guessed numbers, the greater the number the more fun and expensive prize....or maybe not :)
            cout << "Congratulations, You've guessed " << matchingN << " winning numbers!!!" << endl;
        else
            switch(matchingN) {
            case 5:
                cout << "Congratilations, You've guessed 5 winning numbers!!!!" << endl;
                break;

            case 4:
                cout << "Congratulations, You've guessed 4 winning numbers!!" << endl;
                break;

            case 3:
                cout << "Congratulations, You've guessed 3 winning numbers!!" << endl;
                break;

            default:
                cout << "You've guessed " << matchingN << " winning number(s)!!" << endl;
                break;
        }

        cout << "\nBye!\n"; // all is done, good bye
        system("pause");
        return 0;
}
开发者ID:marcialwushu,项目名称:C---Primer-Plus-Exercises-Solutions,代码行数:61,代码来源:main.cpp


示例15: DisplayTicket

void DisplayTicket(const Ticket & t) { // function displays victor<int> array or defined as Ticket
    for (int i = 0; i < t.size(); i++) // go through each element until t.size(), the max number of elements, is reached
        cout << t[i] << " "; // display the element
    cout << endl;
}
开发者ID:marcialwushu,项目名称:C---Primer-Plus-Exercises-Solutions,代码行数:5,代码来源:main.cpp


示例16: createSalesTicket

int createSalesTicket(ConnectNotice &cn)
{
    char    noteText[4096];
    char    summary[4096];
    Ticket  newTick;
    sprintf(summary, "Qwest DSL - %s %s", cn.connType, cn.custCirc);
    newTick.setName(cn.custName);
    newTick.setSummary(summary);
    newTick.setOpened();
    newTick.setModified();
    newTick.setStatus(Ticket::Unexamined);
    newTick.setType(Ticket::Sales);
    newTick.create();


    strcpy(noteText, "The following Qwest connect notice has been recieved and no matching phone numbers could be found for it.<P>\n");
    strcat(noteText, "Action ");
    strcat(noteText, cn.connType);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Notice Date ");
    strcat(noteText, cn.noticeDate);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Name ");
    strcat(noteText, cn.custName);
    strcat(noteText, "<BR>\n");
    
    strcat(noteText, "Addr1 ");
    strcat(noteText, cn.addr1);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Addr2 ");
    strcat(noteText, cn.addr2);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Addr3 ");
    strcat(noteText, cn.addr3);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Select ");
    strcat(noteText, cn.isSelect);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "CBR Number ");
    strcat(noteText, cn.cbr);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "DSL Phone ");
    strcat(noteText, cn.custCirc);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Blarg Circuit ");
    strcat(noteText, cn.hostCirc);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Due Date ");
    strcat(noteText, cn.dueDate);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Speed ");
    strcat(noteText, cn.speed);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "VPI ");
    strcat(noteText, cn.vpi);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "VCI ");
    strcat(noteText, cn.vci);
    strcat(noteText, "<BR>\n");

    newTick.addLogEntry(Ticket::Normal, "%s", noteText);

    ADB tmpDB;
    cn.ticketNo = newTick.ticketNo();
    tmpDB.dbcmd("update QwestDSLNotices set TicketNo = %ld where NoticeID = %ld", cn.ticketNo, cn.noticeID);

    return 1;
}
开发者ID:gottafixthat,项目名称:tacc,代码行数:80,代码来源:qwestconnect.cpp


示例17: scanOrphans

void scanOrphans()
{
    ADB     connDB;
    ADB     phoneDB;
    ADB     workDB;
    char    tmpPhone[1024];
    string  workStr;
    long    custID;
    char    noteText[4096];

    connDB.query("select * from QwestDSLNotices where CustomerID = 0");
    if (!connDB.rowCount) return;
    while (connDB.getrow()) {
        strcpy(tmpPhone, "");
        workStr = connDB.curRow["DSLNumber"];
        strcat(tmpPhone, workStr.substr(0, 3).c_str());
        strcat(tmpPhone, "%%");
        strcat(tmpPhone, workStr.substr(3, 3).c_str());
        strcat(tmpPhone, "%%");
        strcat(tmpPhone, workStr.substr(6, 4).c_str());
        strcat(tmpPhone, "%%");

        //printf("select * from PhoneNumbers where PhoneNumber LIKE '%s'\n", tmpPhone);
        phoneDB.query("select * from PhoneNumbers where PhoneNumber LIKE '%s'", tmpPhone);
        if (phoneDB.rowCount) {
            // Found a matching phone number
            phoneDB.getrow();
            custID = atol(phoneDB.curRow["RefID"]);
            workDB.dbcmd("update QwestDSLNotices set CustomerID = %ld where NoticeID = %ld", custID, atol(connDB.curRow["NoticeID"]));

            // Now, add the notice into the customer notes.
            ADBTable    notesDB("Notes");
            notesDB.setValue("AutoNote",    1);
            notesDB.setValue("AddedBy",     "Auto");
            notesDB.setValue("NoteDate",    connDB.curRow["NoticeDate"]);
            notesDB.setValue("CustomerID",  custID);
            notesDB.setValue("NoteType",    "Qwest DSL");
            notesDB.setValue("Category",    connDB.curRow["Action"]);
            notesDB.setValue("SubCategory", "Connect Notice");
            notesDB.setValue("Subject",     connDB.curRow["Action"]);
            strcpy(noteText, "");
            strcat(noteText, "Action ");
            strcat(noteText, connDB.curRow["Action"]);
            strcat(noteText, "\n");

            strcat(noteText, "Name ");
            strcat(noteText, connDB.curRow["Name"]);
            strcat(noteText, "\n");
            
            strcat(noteText, "Addr1 ");
            strcat(noteText, connDB.curRow["Addr1"]);
            strcat(noteText, "\n");

            strcat(noteText, "Addr2 ");
            strcat(noteText, connDB.curRow["Addr2"]);
            strcat(noteText, "\n");

            strcat(noteText, "Addr3 ");
            strcat(noteText, connDB.curRow["Addr3"]);
            strcat(noteText, "\n");

            strcat(noteText, "Select ");
            strcat(noteText, connDB.curRow["Select256"]);
            strcat(noteText, "\n");

            strcat(noteText, "CBR Number ");
            strcat(noteText, connDB.curRow["CBR"]);
            strcat(noteText, "\n");

            strcat(noteText, "DSL Phone ");
            strcat(noteText, connDB.curRow["DSLNumber"]);
            strcat(noteText, "\n");

            strcat(noteText, "Blarg Circuit ");
            strcat(noteText, connDB.curRow["BlargCircuit"]);
            strcat(noteText, "\n");

            strcat(noteText, "Due Date ");
            strcat(noteText, connDB.curRow["DueDate"]);
            strcat(noteText, "\n");

            strcat(noteText, "Speed ");
            strcat(noteText, connDB.curRow["LineSpeed"]);
            strcat(noteText, "\n");

            strcat(noteText, "VPI ");
            strcat(noteText, connDB.curRow["VPI"]);
            strcat(noteText, "\n");

            strcat(noteText, "VCI ");
            strcat(noteText, connDB.curRow["VCI"]);
            strcat(noteText, "\n");

            notesDB.setValue("NoteText", noteText);
            notesDB.ins();

            // Now that the note has been inserted, check for any
            // tickets that may be opened on this line still.
            if (atol(connDB.curRow["TicketNo"])) {
                // We have a ticket.  Load it up.
//.........这里部分代码省略.........
开发者ID:gottafixthat,项目名称:tacc,代码行数:101,代码来源:qwestconnect.cpp


示例18: main

int main(int argc, const char * argv[]) {
    
    //initialize input variables
    Date_Time DT = *new Date_Time;
    string SN;
    string VN;
    aSeat ST = *new aSeat;
    
    //ensure working program
    cout << "This is program Test_Ticket\n";
    
    //get inputs
    cout << "Please Enter Paramaters for Ticket\n";
    cout << "Show Name: ";
    getline(cin, SN);
    cout << "Venue Name: ";
    getline(cin, VN);
    cout << "Day: ";
    cin >> DT.day;
    Clear_Keyboard_Input_Buffer();
    cout << "Month: ";
    cin >> DT.month;
    Clear_Keyboard_Input_Buffer();
    cout << "Year: ";
    cin >> DT.year;
    Clear_Keyboard_Input_Buffer();
    cout << "Hour: ";
    cin >> DT.hour;
    Clear_Keyboard_Input_Buffer();
    cout << "Minute: ";
    cin >> DT.minute;
    Clear_Keyboard_Input_Buffer();
    cout << "Seat Row: ";
    cin >> ST.row;
    Clear_Keyboard_Input_Buffer();
    cout << "Seat Number: ";
    cin >> ST.num;
    Clear_Keyboard_Input_Buffer();
    cout << endl;
    
    //create ticket
    Ticket *ticket = new Ticket(SN, VN, DT, ST);
    
    //display initial ticket using display()
    cout << "Initial Ticket: " << endl;
    ticket->Display();
    
    //display initial ticket using accessor fuctions
    cout << endl << "Using accessor functions: " << endl;
    cout << "Show_Name = " << ticket->Show_Name() << endl;
    cout << "Venue_Name = " << ticket->Venue_Name() << endl;
    cout << "Date = " << ticket->When().month << "/" << ticket->When().day << "/" << ticket->When().year << endl;
    cout << "Time = " << setw(2)<< setfill('0') << ticket->When().hour << ":" << setw(2) << setfill('0') << ticket->When().minute << endl;
    cout << "Seat " << ticket->Seat().row << ticket->Seat().num << endl;
    if (ticket->Sold() == false) {
        cout << "Not Sold" << endl;
    }
    else{
        cout << "Sold" << endl;
    }
    
    //sell the ticket with Sell()
    cout << endl << "Calling sell for ticket" << endl;
    ticket->Sell();
    
    //display ticket after sale using Display()
    cout << endl << "After ticket sold:" << endl;
    ticket->Display();
    
    delete ticket;
    
    cin.get(); //hold window open
    return 0;
}
开发者ID:Darksole,项目名称:class-projects,代码行数:74,代码来源:Test_Tickets.cpp


示例19: TestCine

void TestCine()
{
  Cine a((Nombre) "Cine1");

  if(a.nombreC()!="Cine1") fallo=1,cout<<"Falla nombreC"<<endl;

  a.abrirSalaC(1);
  a.abrirSalaC(3);
  a.abrirSalaC(5);

  if(a.salasC().longitud()!=3) fallo=1,cout<<"Falla abrirSalaC"<<endl;
  if(!a.salasC().pertenece(1)) fallo=1,cout<<"Falla abrirSalaC"<<endl;
  if(!a.salasC().pertenece(3)) fallo=1,cout<<"Falla abrirSalaC"<<endl;
  if(!a.salasC().pertenece(5)) fallo=1,cout<<"Falla abrirSalaC"<<endl;

  a.agregarPeliculaC(pelis[0],1);
  a.agregarPeliculaC(pelis[1],3);
  a.agregarPeliculaC(pelis[2],5);

  if(a.peliculasC().longitud()!=3) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[0])) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[1])) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[2])) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;

  a.cerrarSalaC(1);
  if(a.salasC().longitud()!=2) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.salasC().pertenece(3)) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.salasC().pertenece(5)) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(a.peliculasC().longitud()!=2) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[1])) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[2])) fallo=1,cout<<"Falla cerrarSalaC"<<endl;

  if(!(a.peliculaC(3)==pelis[1])) fallo=1,cout<<"Falla peliculaC" <<endl;
  if(!(a.peliculaC(5)==pelis[2])) fallo=1,cout<<"Falla peliculaC" <<endl;


  a.pasarA3DUnaPeliculaC("Peli2");
  if(!a.peliculaC(3).es3DP()) fallo=1,cout<<"Falla pasarA3D" <<endl;

  Ticket t;
  t = a.venderTicketC("Peli3");
  if(t.usadoT()) fallo=1,cout<<"Falla venderTicketC"<<endl;
  if(t.salaT()!=5) fallo=1,cout<<"Falla venderTicketC"<<endl;
  if(!(t.peliculaT()==pelis[2])) fallo=1,cout<<"Falla venderTicketC"<<endl;
  a.venderTicketC("Peli3");

  if(a.ticketsVendidosSinUsarC().longitud()!=2) fallo=1,cout<<"Falla ticketsVendidosSinUsarC"<<endl;
  if(!a.ticketsVendidosSinUsarC().pertenece(t)) fallo=1,cout<<"Falla ticketsVendidosSinUsarC"<<endl;

  a.ingresarASalaC(5,t);
  if(a.espectadoresC(5)!=1) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(a.ticketsVendidosSinUsarC().longitud()!=1) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(!a.ticketsVendidosSinUsarC().pertenece(t)) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  t = a.ingresarASalaC(5,t);
  if(a.espectadoresC(5)!=2) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(a.ticketsVendidosSinUsarC().longitud()!=0) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(!t.usadoT()) fallo=1,cout<<"Falla ingresarASalaC"<<endl;

  a.cerrarSalasC(1);

  if(a.peliculasC().longitud()!=1) fallo=1,cout<<"Falla cerrarSalasC1"<<endl;
  if(!a.peliculasC().pertenece(pelis[2])) fallo=1,cout<<"Falla cerrarSalasC2"<<endl;

  ///void cerrarSalasDeLaCadenaC(Lista<Cine> &cs, int e) const;
}
开发者ID:Karamchi,项目名称:Algo1_2_3_Cosas_Viejas,代码行数:65,代码来源:test.cpp



注:本文中的Ticket类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TiffEntry类代码示例发布时间:2022-05-31
下一篇:
C++ Ticker类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap