当前位置: 首页>>代码示例>>C++>>正文


C++ Member::GetLastName方法代码示例

本文整理汇总了C++中Member::GetLastName方法的典型用法代码示例。如果您正苦于以下问题:C++ Member::GetLastName方法的具体用法?C++ Member::GetLastName怎么用?C++ Member::GetLastName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Member的用法示例。


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

示例1: main


//.........这里部分代码省略.........
    }
    else {
        printf ("\tResult 3 - FAIL\n");
    }
    
    /* Error Tests */
    printf ("\tError Tests...... All should fail.\n");
    //firstname high
    printf("\tThese values are too large to be valid\n");
    testResult = azend.SetFirstName("01234567890123456789012345678901234");
    if (testResult == true){
        printf ("\tResult 1 - PASS\n");
        testResult = false;
    }
    else {
        printf ("\tResult 1 - FAIL\n");
    }
    //lastname high
    testResult = azend.SetLastName("holygadimtrappedinacrappyc++programgetmethehelloutofhere");
    if (testResult == true){
        printf ("\tResult 2 - PASS\n");
        testResult = false;
    }
    else {
        printf ("\tResult 2 - FAIL\n");
    }
    //firstname zero
    printf("\tThese are empty strings therefore invalid\n");
    testResult = azend.SetFirstName("");
    if (testResult == true){
        printf ("\tResult 1 - PASS\n");
        testResult = false;
    }
    else {
        printf ("\tResult 1 - FAIL\n");
    }
    //lastname zero
    testResult = azend.SetLastName("");
    if (testResult == true){
        printf ("\tResult 2 - PASS\n");
        testResult = false;
    }
    else {
        printf ("\tResult 2 - FAIL\n");
    }
    //ibutton high
    printf("\tThis iButton Address is too large\n");
    testResult = azend.SetiButtonAddr(testAddr2, arraySize[1]);
    if (testResult == true){
        printf ("\tResult 3 - PASS\n");
        testResult = false;
    }
    else {
        printf ("\tResult 3 - FAIL\n");
    }
    //ibutton low
    printf("\tThis iButton Address is too small\n");
    testResult = azend.SetiButtonAddr(testAddr3, arraySize[2]);
    if (testResult == true){
        printf ("\tResult 3 - PASS\n\n");
        testResult = false;
    }
    else {
        printf ("\tResult 3 - FAIL\n\n");
    }
    
    /*
    Testing the accessors
    */
    //
    printf("\tTesting accessors......  \n\n");
    //Getting First Name
    newFirstName = azend.GetFirstName();
    printf("\tThe new firstname is: %s\n", newFirstName.c_str());
    //Getting Last Name
    newLastName = azend.GetLastName();
    printf("\tThe new lastname is: %s\n", newLastName.c_str());
    //Getting iButton Address
    /*newAddr = azend.GetiButtonAddr();
    for (int i = 0; i < IBUTTON_BYTES; i++){
        printf("%c", newAddr[i]);
    }*/
    printf("\n\n");
        
    /*
    Testing the iButton Comparison
    */
    /*
    printf("\tTesting iButton comparison..... \n\n");
    testResult = azend.CompareiButton(newAddr);
    if (testResult == true){
        printf("The buttons are the same! YAY!\n");
    }
    else if (testResult == false){
        printf("The buttons are not the same :-(\n");
    }
    */
        
    return 0;
}
开发者ID:azend,项目名称:DSAD-OOP-Assignment-2,代码行数:101,代码来源:testMember.cpp


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