zoukankan      html  css  js  c++  java
  • 如果“不可能发生”的事情的确发生了,则要 使用断言进行报警

    一般教科书都鼓励程序员们进行防错设计,但要记住这种编程风格可 能会隐瞒错误。

    当进行防错设计时,如果“不可能发生”的事情的确发生了,则要 使用断言进行报警。

     1 #include <iostream>
     2 #include <string.h>
     3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     4 
     5 using namespace std;
     6 int main(int argc, char** argv) {
     7         //设置字符串
     8     char string[] = "Fill the string with something";
     9     cout<<"string:"<<string<<endl;
    10     char *p=strset(string,'*');
    11     cout<<"p     :"<<p<<endl;
    12     cout<<"string:"<<string<<endl;
    13 
    14     //按指定字符和指定数目设置字符数组
    15     char string1[] = "Fill the string with something";
    16     cout<<"string1:"<<string1<<endl;
    17     p=strnset(string1,'*',5);
    18     cout<<"p    :"<<p<<endl;
    19     cout<<"string1:"<<string1<<endl;
    20     return 0;
    21 }
  • 相关阅读:
    C#第八节课
    C#第七节课
    C#第六节课
    supervisor进程管理的使用
    oracle分区表
    Zabbix配置邮件监控
    python连接oracle数据库
    json内存级非关系数据库
    Oracle 12c CDB PDB 安装/配置/管理
    Let's Encrypt免费泛域名证书申请
  • 原文地址:https://www.cnblogs.com/borter/p/9413642.html
Copyright © 2011-2022 走看看