码迷,mamicode.com
首页 > 其他好文 > 详细

练习一下

时间:2018-10-20 23:45:39      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:set   print   clu   stream   out   string   define   void   int   

#include <ncurses.h>
#include <string>
#include <vector>
//#define DEBUG
#ifdef DEBUG
#include <iostream>
#include <cstdio>
#endif
int main(void)
{
    int x,y;
    std::vector<std::string> msg;
    msg.push_back("Hello Ncurses!");
    msg.push_back("Please Enter Anykey to exit. . .");
    std::vector<std::string>::iterator pa=msg.begin();
#ifndef DEBUG
    initscr();
    curs_set(0);
    noecho();
    getmaxyx(stdscr,y,x);
    //refresh();
    //mvprintw(y/2,x/2-pa->size()/2,pa->c_str());
    for(int i=0;pa!=msg.end();++pa,++i)
        mvprintw(y/2+i,x/2-pa->size()/2,pa->c_str());
    //refresh();
    getch();
    echo();
    curs_set(1);
    endwin();
#else
    printf("%s\n",(++pa)->c_str());
    std::cout<<*pa<<std::endl;
#endif
    return 0;
}

 

练习一下

标签:set   print   clu   stream   out   string   define   void   int   

原文地址:https://www.cnblogs.com/wljcom/p/9823370.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!