list类 qDebug 的两种用法

#include <QDebug>

int main(int argc,char *argv[])

{

QList<int> list;

list<<1<<2<<3<<4<<5;

QListIterator<int> i(list);

//用法一,没有#include <QDebug>,默认为C语言的用法

qDebug("Items in list: %d", list.size()); 

for(;i.hasNext();) 

qDebug()<<i.next(); //用法二,输出i.next()

 

return 0;

}

 

 

相关文章:

  • 2022-12-23
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2021-04-17
  • 2021-12-14
  • 2021-12-25
  • 2021-07-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案