gpt4 book ai didi

c++ - 为 Palm OS 开发类似控制台的应用程序

转载 作者:搜寻专家 更新时间:2023-10-31 02:01:01 27 4
gpt4 key购买 nike

我正在学习 C++,但我只开发控制台应用程序,因为图形 C++ 开发非常困难,然后我想知道我是否可以为 Palm OS 开发类似应用程序的控制台,我想要的是这个,编译这段代码以 Palm OS 为例:

// ClientFille.cpp
// Cria um arquivo sequencial.

#include <iostream>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::ios;

#include <fstream> // Fluxo de arquivos
using std::ofstream; // Gera a saída do fluxo do arquivo

#include <cstdlib>
using std::exit; // Sai do protótipo de funcão

int main()
{
// Construtor ofstream abre arquivo
ofstream outClientFile( "Clients.dat", ios::out );

// Fecha o programa se não conseguir criar o arquivo
if ( !outClientFile ) // Operador ! sobrecarregado
{
cerr << "File could not be opened" << endl;
exit( 1 );
} // Fim do if

cout << "Enter the account, name, and balance." << endl
<< "Enter end-of-file to end the input.\n? ";

int account;
char name[ 30 ];
double balance;

// Lê conta, nome e saldo a partir de cin, então coloca no arquivo
while ( cin >> account >> name >> balance )
{
outClientFile << account << ' ' << name << ' ' << balance << endl;
cout << "? ";
} // Fim do while

return 0; // Destruitor ofstream fecha o arquivo
} // Fim de main

谢谢!

最佳答案

I/O 的命令行界面方法在围绕触摸/点击屏幕设计的设备上对于大部分用户交互来说并不是很有效 - 所以虽然你可能,可能,找到一些方法来做控制台类型I/O,这不会是理想的用户体验。

更不用说,大多数 Palm 设备(和其他 PDA)没有完整的 102+ 键键盘 - 因此输入像 EOF 这样的东西并不是一件容易的事。

关于c++ - 为 Palm OS 开发类似控制台的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1219879/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com