本文整理汇总了C++中printText函数的典型用法代码示例。如果您正苦于以下问题:C++ printText函数的具体用法?C++ printText怎么用?C++ printText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switchEcho
static void switchEcho(int tokenCount, char **tokens)
{
int state;
if (tokenCount < 2)
{
printText("Echo on or off?");
return;
}
switch (*(tokens[1]))
{
case '0':
state = 0;
oK(_echo(&state));
break;
case '1':
state = 1;
oK(_echo(&state));
break;
default:
printText("Echo on or off?");
}
}
示例2: main
int main()
{
setlocale(LC_ALL, "RUS");
char text[SIZE], sym;
char *head, *tail;
int i;
srand(time(NULL));
for (i = 0; i < SIZE ; i++) {
text[i] = 97 + (rand() % 25);
}
printf("Исходный массив символов:\n");
printText(text, SIZE);
for (head = text, tail = &text[SIZE - 1]; head < tail;) {
sym = *head;
*head++ = *tail;
*tail-- = sym;
}
printf("В обратном порядке:\n");
printText(text, SIZE);
return 0;
}
示例3: glTranslatef
void Colormap::render(float min, float max, int minorTicks) {
int step = 1;
int width = 50;
glTranslatef(10, 10, 10);
glColor3f(1, 1, 1);
glBegin(GL_LINES);
glVertex2f(1, 1);
glVertex2f(1, 256 * step + 2);
glVertex2f(1, 256 * step + 2);
glVertex2f(width, 256 * step + 2);
glVertex2f(width, 256 * step + 2);
glVertex2f(width, 1);
glVertex2f(width, 1);
glVertex2f(1, 1);
glEnd();
glBegin(GL_QUADS);
for (size_t i = 0; i < 256; i++) {
glColor3f(colors[i].red, colors[i].green, colors[i].blue);
glVertex2f(1, 1 + (i * step) + step); // Top Left
glVertex2f(width - 1, 1 + (i * step) + step); // Top Right
glColor3f(colors[i].red, colors[i].green, colors[i].blue);
glVertex2f(width - 1, 1 + i * step); // Bottom Right
glVertex2f(1, 1 + i * step); // Bottom Left
}
glEnd();
glColor3f(1, 1, 1);
glBegin(GL_LINES);
glVertex2f(width, 2);
glVertex2f(width + 5, 2);
glEnd();
printText(width + 8, 1 - 3.5, float2str(min));
minorTicks = minorTicks + 1;
for (int tick = 1; tick < minorTicks; tick++) {
glBegin(GL_LINES);
glVertex2f(width, tick * ((256 * step) / minorTicks));
glVertex2f(width + 2, tick * ((256 * step) / minorTicks));
glEnd();
float val = min + tick * (fabs(min - max) / minorTicks);
printText(width + 5, tick * ((256 * step) / minorTicks) - 3.5, float2str(val));
}
glBegin(GL_LINES);
glVertex2f(width, 256 * step + 1);
glVertex2f(width + 5, 256 * step + 1);
glEnd();
printText(width + 8, 256 * step - 3.5, float2str(max));
glTranslatef(-10, -10, -10);
}
示例4: printText
void SenMLRecord::fieldsToJson()
{
int bnLength = this->_name.length();
if(bnLength){
printText("\"n\":\"", 5);
printText(this->_name.c_str(), bnLength);
printText("\"", 1);
}
if(!isnan(this->_time)){
printText(",\"t\":", 5);
printDouble(this->_time, SENML_MAX_DOUBLE_PRECISION);
}
if(this->_unit != SENML_UNIT_NONE){
printText(",\"u\":\"", 6);
printUnit(this->_unit);
printText("\"", 1);
}
if(this->_updateTime != 0){
printText(",\"ut\":", 5);
#ifdef __MBED__
char buf[10];
sprintf(buf, "%d", this->_updateTime);
String val = buf;
#else
String val(this->_updateTime);
#endif
printText(val.c_str(), val.length());
}
}
示例5: infoProfile
static void infoProfile(int tokenCount, char **tokens)
{
DtpcVdb *vdb = getDtpcVdb();
Profile *vprofile;
PsmAddress elt;
PsmPartition wm = getIonwm();
unsigned int profileID;
if (tokenCount != 3)
{
SYNTAX_ERROR;
return;
}
profileID = atoi(tokens[2]);
for (elt = sm_list_first(wm, vdb->profiles); elt;
elt = sm_list_next(wm, elt))
{
vprofile = (Profile *) psp(wm, sm_list_data(wm, elt));
if (vprofile->profileID == profileID)
{
break;
}
}
if (elt == 0)
{
printText("Unknown profile.");
return;
}
printProfile(vprofile);
}
示例6: executeAdd
static void executeAdd(int tokenCount, char **tokens)
{
if (tokenCount < 2)
{
printText("Add what?");
return;
}
if (strcmp(tokens[1], "profile") == 0)
{
if (tokenCount != 10 && tokenCount != 9)
{
SYNTAX_ERROR;
return;
}
oK(addProfile(strtol(tokens[2], NULL, 0),
strtol(tokens[3], NULL, 0),
strtol(tokens[4], NULL, 0),
strtol(tokens[5], NULL, 0),
strtol(tokens[6], NULL, 0),
tokens[7], tokens[8], tokens[9]));
return;
}
SYNTAX_ERROR;
}
示例7: preprocessString
void TextDisplayer::printCharacterText(const char *text, int8 charNum, int charX) {
int top, left, x1, x2, w, x;
char *msg;
text = preprocessString(text);
int lineCount = buildMessageSubstrings(text);
w = getWidestLineWidth(lineCount);
x = charX;
calcWidestLineBounds(x1, x2, w, x);
uint8 color = 0;
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
const uint8 colorTable[] = { 0x1F, 0x1B, 0xC9, 0x80, 0x1E, 0x81, 0x11, 0xD8, 0x55, 0x3A, 0x3A };
color = colorTable[charNum];
setTextColor(color);
} else {
const uint8 colorTable[] = { 0x0F, 0x09, 0xC9, 0x80, 0x05, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3A };
color = colorTable[charNum];
}
for (int i = 0; i < lineCount; ++i) {
top = i * 10 + _talkMessageY;
msg = &_talkSubstrings[i * TALK_SUBSTRING_LEN];
left = getCenterStringX(msg, x1, x2);
printText(msg, left, top, color, 0xC, 0);
}
}
示例8: main
int main()
{
int key = 0;
setlocale(LC_ALL, "rus");
printf("Enter '1' if you want to sort poem in forward order \n"
"Enter '2' if you want to sort poem in reverse order and get new part of poem \n"
"You choise > ");
if (!scanf_s("%d", &key) || (key != 1 && key != 2))
{
printf("Wrong format. Try again (maybe without brackets)\n"
"> ");
key = getchar();
if (!scanf_s("%d", &key)) printf("Sorry, I'm closing.\n");
}
//unsigned int start_time = clock();
int StringCount = 0;
size_t Textlen = 0;
Text_t *text = InitText(&StringCount, &Textlen);
int isOkSort = sortText(text, key, &StringCount, Textlen);
assert(isOkSort);
int isOkPrint = printText(text, StringCount, key);
assert(isOkPrint);
int isOkMemory = Struct_Destrucktor(text);
assert(isOkMemory);
//unsigned int end_time = clock();
//unsigned int search_time = end_time - start_time;
//printf("%u\n", search_time);
return 0;
}
示例9: menuBar
//-----------------------------------------------------------------------------
void MainWindow::makeMenu()
{
QAction *a;
QMenu *o;
// file menu
{
o = menuBar()->addMenu(_("File"));
a = new QAction(QPixmap(":/png/document-new.png"), _("New script"), this);
connect(a, SIGNAL(triggered()), this, SLOT(newDoc()));
a->setToolTip(_("Create new empty script window (Ctrl+N)."));
a->setShortcut(Qt::CTRL+Qt::Key_N); o->addAction(a);
o->addAction(aload);
o->addAction(asave);
a = new QAction(_("Save as ..."), this);
connect(a, SIGNAL(triggered()), this, SLOT(saveAs()));
o->addAction(a);
o->addSeparator();
o->addAction(_("Print script"), edit, SLOT(printText()));
a = new QAction(QPixmap(":/png/document-print.png"), _("Print graphics"), this);
connect(a, SIGNAL(triggered()), graph->mgl, SLOT(print()));
a->setToolTip(_("Open printer dialog and print graphics (Ctrl+P)"));
a->setShortcut(Qt::CTRL+Qt::Key_P); o->addAction(a);
o->addSeparator();
fileMenu = o->addMenu(_("Recent files"));
o->addSeparator();
o->addAction(_("Quit"), qApp, SLOT(closeAllWindows()));
}
menuBar()->addMenu(edit->menu);
menuBar()->addMenu(graph->menu);
// settings menu
{
o = menuBar()->addMenu(_("Settings"));
a = new QAction(QPixmap(":/png/preferences-system.png"), _("Properties"), this);
connect(a, SIGNAL(triggered()), this, SLOT(properties()));
a->setToolTip(_("Show dialog for UDAV properties.")); o->addAction(a);
o->addAction(_("Set arguments"), createArgsDlg(this), SLOT(exec()));
o->addAction(acalc);
o->addAction(ainfo);
o->addAction(ahide);
}
menuBar()->addSeparator();
o = menuBar()->addMenu(_("Help"));
a = new QAction(QPixmap(":/png/help-contents.png"), _("MGL help"), this);
connect(a, SIGNAL(triggered()), this, SLOT(showHelp()));
a->setToolTip(_("Show help on MGL commands (F1)."));
a->setShortcut(Qt::Key_F1); o->addAction(a);
a = new QAction(QPixmap(":/png/help-faq.png"), _("Hints"), this);
connect(a, SIGNAL(triggered()), this, SLOT(showHint()));
a->setToolTip(_("Show hints of MGL usage.")); o->addAction(a);
o->addAction(_("About"), this, SLOT(about()));
o->addAction(_("About Qt"), this, SLOT(aboutQt()));
}
示例10: printBlock
/*! \fn static void printBlock(uint8_t num)
* \brief Print text 'Block' followed by blocknumber
*
* \param uint8_t num - number to be printed next to 'Block #' string
*/
static void printBlock(uint8_t num)
{
char str[4];
printTextP(PSTR("\nBlock #"));
char_to_string(num, str);
printText(str);
}
示例11: while
void Terminal::readError()
{
while(process->canReadLine()){
QByteArray array(process->readLine().constData());
emit printText(array);
}
}
示例12: printText
void Terminal::accept(QString command)
{
acceptedCommands << command;
QByteArray aa=command.append("\n").toUtf8();
process->write(aa);
emit printText(command);
}
示例13: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL, "rus");
int key = 0;
//char codeWord[8] = {};
printf("Enter '1' if you want to sort poem in forward order \n"
"Enter '2' if you want to sort poem in reverse order and get new part of poem \n"
"You choise: ");
scanf_s("%d", &key);
//unsigned int start_time = clock();
int count = 0;
size_t len = 0;
char** text = InitText(&count,&len);
int isOkSort = sortText(text, key, &count, len);
assert(isOkSort);
int isOkPrint = printText(text, count, key);
assert(isOkPrint);
int isOkMemory = freeMemory(text);
assert(isOkMemory);
//unsigned int end_time = clock();
//unsigned int search_time = end_time - start_time;
//printf("%u\n", search_time);
return 0;
}
示例14: executeList
static void executeList(int tokenCount, char **tokens)
{
Sdr sdr = getIonsdr();
PsmPartition ionwm = getIonwm();
IonVdb *vdb = getIonVdb();
PsmAddress elt;
PsmAddress addr;
char buffer[RFX_NOTE_LEN];
if (tokenCount < 2)
{
printText("List what?");
return;
}
if (strcmp(tokens[1], "contact") == 0)
{
CHKVOID(sdr_begin_xn(sdr));
for (elt = sm_rbt_first(ionwm, vdb->contactIndex); elt;
elt = sm_rbt_next(ionwm, elt))
{
addr = sm_rbt_data(ionwm, elt);
rfx_print_contact(addr, buffer);
printText(buffer);
}
sdr_exit_xn(sdr);
return;
}
if (strcmp(tokens[1], "range") == 0)
{
CHKVOID(sdr_begin_xn(sdr));
for (elt = sm_rbt_first(ionwm, vdb->rangeIndex); elt;
elt = sm_rbt_next(ionwm, elt))
{
addr = sm_rbt_data(ionwm, elt);
rfx_print_range(addr, buffer);
printText(buffer);
}
sdr_exit_xn(sdr);
return;
}
SYNTAX_ERROR;
}
示例15: printKin
static void printKin(uvast kin, uvast parent)
{
char buffer[32];
isprintf(buffer, sizeof buffer, UVAST_FIELDSPEC " %s", kin,
kin == parent ? "parent" : "");
printText(buffer);
}