本文整理汇总了C++中printTable函数的典型用法代码示例。如果您正苦于以下问题:C++ printTable函数的具体用法?C++ printTable怎么用?C++ printTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printTable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
const char *colFmts[] = {" %-5.5s"," %-5.5s"," %-9.9s"};
String r1[] = { "a101", "red", "Java" };
String r2[] = { "ab40", "gren", "Smalltalk" };
String r3[] = { "ab9", "blue", "Fortran" };
String r4[] = { "ab09", "ylow", "Python" };
String r5[] = { "ab1a", "blak", "Factor" };
String r6[] = { "ab1b", "brwn", "C Sharp" };
String r7[] = { "Ab1b", "pink", "Ruby" };
String r8[] = { "ab1", "orng", "Scheme" };
String *rows[] = { r1, r2, r3, r4, r5, r6, r7, r8 };
struct sTable table;
table.rows = rows;
table.n_rows = 8;
table.n_cols = 3;
sortTable(&table, "");
printf("sort on col 0, ascending\n");
printTable(&table, stdout, colFmts);
sortTable(&table, "ro", 1, &cmprStrgs);
printf("sort on col 0, reverse.special\n");
printTable(&table, stdout, colFmts);
sortTable(&table, "c", 1);
printf("sort on col 1, ascending\n");
printTable(&table, stdout, colFmts);
sortTable(&table, "cr", 2, 1);
printf("sort on col 2, reverse\n");
printTable(&table, stdout, colFmts);
return 0;
}
开发者ID:Anatolt,项目名称:RosettaCodeData,代码行数:35,代码来源:optional-parameters.c
示例2: while
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void MNcursesPlugin::readUserInput() {
while ( true ) {
int ch = getch();
if ( ch == '<' ) {
int idx = findTag(_activeTag);
if ( idx >= 0 ) {
if ( --idx < 0 ) idx = _tagOrder.size() - 1;
_activeTag = _tagOrder[idx];
printTable(_clientTableCache);
}
}
else if ( ch == '>' ) {
int idx = findTag(_activeTag);
if ( idx >= 0 ) {
idx = (idx + 1) % _tagOrder.size();
_activeTag = _tagOrder[idx];
printTable(_clientTableCache);
}
}
else if ( ch == 'r' ) {
_reverseSortOrder = !_reverseSortOrder;
printTable(_clientTableCache);
}
}
}
开发者ID:Fran89,项目名称:seiscomp3,代码行数:26,代码来源:mncursesplugin.cpp
示例3: main
int main ()
{
printf ("Table of gallon/pint to liter equivalents\n");
printTable (toLiters);
printf ("\n\nTable of feet/inch to centimenter equivalents\n");
printTable (toCenti);
return 0;
}
开发者ID:VBashlovkina,项目名称:161sp15,代码行数:10,代码来源:func-parm.c
示例4: main
int main(void)
{
int arr_size = 10;
int arr[arr_size];
char *strings[10] = {"str01", "str02", "str03", "str04", "str05", "str06", "str07", "str08", "str09", "str10"};
for(int i = 0; i < arr_size; i++) {
arr[i] = i;
}
bl_hashtable *ht = bl_hashtable_new(10);
for(int i = 0; i < arr_size; i++) {
bl_hashtable_insert(ht, strings[i], strlen(strings[i]) + 1, &arr[i]);
}
printTable(ht);
printf("count = %lu\n", bl_hashtable_count(ht));
/*
bl_hashtable_remove(ht, strings[0], strlen(strings[0]) + 1);
bl_hashtable_remove(ht, strings[6], strlen(strings[6]) + 1);
bl_hashtable_remove(ht, strings[9], strlen(strings[9]) + 1);
bl_hashtable_remove(ht, strings[5], strlen(strings[5]) + 1);
*/
int newInt = 60;
int newInt2 = 78;
// return ptr to old data
printf("changed data = %d\n", *(int *)bl_hashtable_modify(ht, strings[6], strlen(strings[6]) + 1, &newInt));
// had to create new elm, returned ptr to new data
printf("'modified' new data = %d\n", *(int *)bl_hashtable_modify(ht, "newString", strlen("newString") + 1, &newInt2));
printf("\n");
printTable(ht);
printf("count = %lu\n", bl_hashtable_count(ht));
int user_int = 5;
bl_hashtable_foreach(ht, &user_int, (plus));
printf("\n");
printTable(ht);
printf("count = %lu\n", bl_hashtable_count(ht));
printf("\n");
bl_hashtable_rehash(ht, 6);
printTable(ht);
printf("count = %lu\n", bl_hashtable_count(ht));
bl_hashtable_foreach_remove(ht, NULL, NULL);
//bl_hashtable_free(ht); // gets rid of the hash entirely
printf("\n");
printTable(ht);
printf("count = %lu\n", bl_hashtable_count(ht));
return 0;
}
开发者ID:benjlouie,项目名称:bl_library,代码行数:55,代码来源:bl_hash_test.c
示例5: printAllTables
void printAllTables(){
printf("INITIAL TABLE\n");
printTable(initialTable);
printf("\n");
int i;
for(i = 0; i < NUMOFSYMBOL; i++){
printf("\nTABLE %d\n", i);
printTable(tables[i]);
}
}
开发者ID:arvinwiyono,项目名称:rice-coder-preprocessor,代码行数:11,代码来源:context.c
示例6: weights
void BipartiteWeightedMatchingBinding::bindFunctUnitInState(raw_ostream &out,
State* state, std::string funcUnitType, int numFuncUnitsAvail,
AssignmentInfo &assigned) {
// create a numFuncUnitsAvail x numFuncUnitsAvail matrix of integer weights
// and assignments for solving the bipartite weighted matching problem
Table weights(numFuncUnitsAvail, std::vector<int>(numFuncUnitsAvail));
Table assignments(numFuncUnitsAvail, std::vector<int>(numFuncUnitsAvail));
std::string tmp;
raw_string_ostream weights_stream(tmp);
// loop over all operations in this state
int operationIdx = 0;
for (State::iterator instr = state->begin(), ie = state->end();
instr != ie; ++instr) {
Instruction *I = *instr;
if (shareInstructionWithFU(I, funcUnitType)) {
constructWeights(weights_stream, I, operationIdx, funcUnitType,
numFuncUnitsAvail, assigned, weights);
opInstr[operationIdx] = I;
operationIdx++;
}
}
// only share if there is more than one operation using
// this functional unit
int numOperationsToShare = operationIdx;
if (numOperationsToShare >= 1) {
out << "State: " << state->getName() << "\n";
out << "Binding functional unit type: " << funcUnitType << "\n";
out << "Weight matrix for operation/function unit matching:\n";
weights_stream.flush();
out << weights_stream.str();
printTable(out, funcUnitType, numOperationsToShare, numFuncUnitsAvail,
weights);
out << "Solving Bipartite Weighted Matching (minimize weights)...\n";
solveBipartiteWeightedMatching(weights, assignments);
out << "Assignment matrix after operation/function unit matching:\n";
printTable(out, funcUnitType, numOperationsToShare, numFuncUnitsAvail,
assignments);
out << "Checking that every operator was assigned to a functional unit...";
CheckAllWereAssigned(numOperationsToShare, numFuncUnitsAvail,
assignments);
out << "yes\n";
out << "Binding operator -> functional unit assignments:\n";
UpdateAssignments(out, numOperationsToShare, funcUnitType,
numFuncUnitsAvail, assigned, assignments);
}
}
开发者ID:RCSL-HKUST,项目名称:heterosim,代码行数:53,代码来源:BipartiteWeightedMatchingBinding.cpp
示例7: printTables
void printTables(){
printf("\n-- Instruction Table --\n\n");
printInstructionTable();
printf("\n-- Symbol Table --\n\n");
printTable(&symbolTable);
printf("\n-- Jump Table --\n\n");
printTable(&jumpTable);
printf("\n-- Stack --\n\n");
printStack(&stack);
}
开发者ID:kinneerd,项目名称:CWICI,代码行数:13,代码来源:instructions.c
示例8: main
int main(int argc, char *argv[]){
char fileName[30],heroName[30],super[30],appear[6];
char slash[2],slash2[2], command[10] = "null";
char newLine;
if(argc == 3){
strcpy(command, argv[2]);
strcpy(fileName, argv[1]);
}else if(argc ==2){
strcpy(fileName, argv[1]);
}else{
printErr(argv[0]);
return -1;
}
FILE *f = fopen(fileName, "r");
if(f ==NULL){
fprintf(stderr,"Error opening file %s.\n", fileName);
return 42;
}
struct Hero heroes[100];
int count = 0;
while(fscanf(f,"%[^/]%[/]%[^/]%[/]%s%c",heroName,slash, super,slash2, appear,&newLine)==6){
strcpy(heroes[count].name,heroName);
strcpy(heroes[count].super,super);
strcpy(heroes[count].appear,appear);
count++;
}
if(strcmp(command,"plain")==0){
qsort(heroes,count,sizeof(struct Hero),compare_name);
printTable(heroes,command,count);
}else if(strcmp(command,"super")==0){
qsort(heroes,count,sizeof(struct Hero),compare_super);
printTable(heroes,command,count);
}else if(strcmp(command,"appear")==0){
qsort(heroes,count,sizeof(struct Hero), compare_appear);
printTable(heroes,command,count);
}else if(strcmp(command,"null")==0){
printTable(heroes,command,count);
}else{
printErr(argv[0]);
}
fclose(f);
return 0;
}
开发者ID:JPoirier55,项目名称:CS157,代码行数:50,代码来源:las.c
示例9: main
int main()
{
constexpr std::size_t R = 5;
constexpr std::size_t C = 5;
int table[R][C] { };
printTable(table, R);
*(*(table + 0) + 0) = 100;
*(*(table + 1) + 1) = 200;
printTable(table, R);
}
开发者ID:CCJY,项目名称:coliru,代码行数:14,代码来源:main.cpp
示例10: setup
void PrintLayout::print()
{
// we call setup each time to check if the printer properties have changed
setup();
if (pageW == 0 || pageH == 0) {
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(tr("Subsurface cannot find a usable printer on this system!"));
msgBox.setWindowIcon(QIcon(":subsurface-icon"));
msgBox.exec();
return;
}
switch (printOptions->type) {
case print_options::PRETTY:
printProfileDives(3, 2);
break;
case print_options::ONEPERPAGE:
printProfileDives(1, 1);
break;
case print_options::TWOPERPAGE:
printProfileDives(2, 1);
break;
case print_options::TABLE:
printTable();
break;
}
}
开发者ID:Cgruppo,项目名称:subsurface,代码行数:27,代码来源:printlayout.cpp
示例11: moveSpace
void moveSpace(Puzzle *puzzle, const Table nextmap, const Position pos) {
int x = puzzle->space.x;
int y = puzzle->space.y;
dputs("moveSpace");
dcode(printf("px=%d py=%d\n", pos.x, pos.y));
dcode(printTable("nextmap", nextmap));
while (pos.x != x || pos.y != y) {
dcode(printf("x=%d y=%d nm=%d\n", x, y, nextmap[y][x]));
switch (nextmap[y][x]) {
case MOVE_LEFT:
moveLeftSpace(puzzle);
break;
case MOVE_RIGHT:
moveRightSpace(puzzle);
break;
case MOVE_UP:
moveUpSpace(puzzle);
break;
case MOVE_DOWN:
moveDownSpace(puzzle);
break;
default:
dputs("return");
return;
}
x = puzzle->space.x;
y = puzzle->space.y;
}
dputs("end");
}
开发者ID:neetsdkasu,项目名称:Paiza-POH-MyAnswers,代码行数:30,代码来源:answer.c
示例12: lua_type
void CDebugHelper::printStackValue(lua_State* pState, int index)
{
int type = lua_type(pState, index);
switch(type)
{
case LUA_TNUMBER:
printf("%g\n", lua_tonumber(pState, index));
break;
case LUA_TSTRING:
printf("%s\n", lua_tostring(pState, index));
break;
case LUA_TBOOLEAN:
printf("%d\n", int(lua_toboolean(pState, index)));
break;
case LUA_TTABLE:
printTable(pState, index);
break;
case LUA_TTHREAD:
case LUA_TFUNCTION:
case LUA_TUSERDATA:
case LUA_TLIGHTUSERDATA:
printf("%s:%p\n", lua_typename(pState, type), lua_topointer(pState, -1));
break;
default:
printf("nil value\n");
break;
}
}
开发者ID:heartshare,项目名称:luahelper,代码行数:28,代码来源:debughelper.cpp
示例13: main
int main(int argc, char * argv[]) {
int * table;
int tableRange;
if(argc == 1)
tableRange = 10;
else {
tableRange = atoi(argv[1]);
if(tableRange < 1 || tableRange > 10)
usageAndQuit();
}
table = (int *) malloc(sizeof(int) * (tableRange * tableRange));
if(table == NULL)
printf("Memory allocation for table failed.");
fillTable(table, tableRange, (tableRange * tableRange));
printTable(table, tableRange, (tableRange * tableRange));
free(table);
return 0;
}
开发者ID:giang12,项目名称:Introduction-to-Operating-Systems,代码行数:26,代码来源:multiplication_table.c
示例14: adams
Vector adams()
{
size_t numof_xs = get_numof_xs(h);
Vector runge_ys = runge();
Vector adams_ys;
initVector(&adams_ys, numof_xs);
for (size_t i = 0; i < adams_acc; ++i)
append(&adams_ys, runge_ys.values[i]);
disposeVector(&runge_ys);
Vector etas;
initVector(&etas, numof_xs);
for (size_t i = 0; i < adams_acc; ++i)
append(&etas, eta(i, adams_ys.values[i]));
FiniteDiffTable table = createFiniteDiffTable(&etas);
for (size_t k = 5; k < numof_xs; ++k) {
double yk = adams_next_yk(adams_ys.values[k - 1], &table);
append(&adams_ys, yk);
append(&etas, eta(k, yk));
disposeFiniteDiffTable(&table);
table = createFiniteDiffTable(&etas);
}
printTable(&table, &adams_ys, stdout);
disposeVector(&etas);
disposeFiniteDiffTable(&table);
return adams_ys;
}
开发者ID:ramntry,项目名称:numerical_analysis,代码行数:29,代码来源:main.c
示例15: testRetrieve
void testRetrieve(void) {
// This depends on testStore being run. because reasons!
char names[FIELD_SIZE][NAME_LIMIT] = { "name4", "name2", "name3", "name1", };
FieldType types[FIELD_SIZE][1] = { INTEGER, TEXT, DATE, INTEGER, };
struct Field* projection = createFieldList(names, NULL, types, 4);
struct Field* whereField = createField("name1", "2", INTEGER);
struct Where* compare = createWhere(whereField, EQUAL);
struct Command* selectCmd = createSelectCommand("table", projection, compare);
struct Table* results = retrieve(selectCmd);
printTable(results);
assert(results->count == 1, "Did not retrieve correct number of records");
assert(strcmp(results->name, "table") == 0, "Table name was not set in the resultset");
assert(strcmp(results->tuples[0].fields[0].name, "name1") == 0 , "Problem with resultset");
assert(strcmp(results->tuples[0].fields[1].name, "name2") == 0 , "Problem with resultset");
assert(strcmp(results->tuples[0].fields[2].name, "name3") == 0 , "Problem with resultset");
assert(strcmp(results->tuples[0].fields[3].name, "name4") == 0 , "Problem with resultset");
assert(results->tuples[0].fields[4].name == 0 , "Problem with resultset"); // make sure null terminated
assert(strcmp((char*) results->tuples[0].fields[0].value, "2") == 0 , "Problem with resultset");
assert(strcmp((char*) results->tuples[0].fields[1].value, "value2") == 0 , "Problem with resultset");
assert(strcmp((char*) results->tuples[0].fields[2].value, "1/1/2015") == 0 , "Problem with resultset");
assert(strcmp((char*) results->tuples[0].fields[3].value, "3") == 0 , "Problem with resultset");
assert(results->tuples[0].fields[4].name == 0 , "Problem with resultset");
}
开发者ID:SCostello84,项目名称:cop4710-sequel,代码行数:29,代码来源:test.c
示例16: b
QString cm3DebugRegs::printTPIRegisters()
{
quint32 a;
TPI_Type tpi;
QVector<quint32> b(15);
memset(&tpi,0,sizeof(tpi));
b[0] = tpi.SSPSR = stl->ReadMemoryWord(a = address(TPI,SSPSR));
b[1] = tpi.CSPSR = stl->ReadMemoryWord(a = address(TPI,CSPSR));
b[2] = tpi.ACPR = stl->ReadMemoryWord(a = address(TPI,ACPR));
b[3] = tpi.SPPR = stl->ReadMemoryWord(a = address(TPI,SPPR));
b[4] = tpi.FFSR = stl->ReadMemoryWord(a = address(TPI,FFSR));
b[5] = tpi.FFCR = stl->ReadMemoryWord(a = address(TPI,FFCR));
b[6] = tpi.FSCR = stl->ReadMemoryWord(a = address(TPI,FSCR));
b[7] = tpi.TRIGGER = stl->ReadMemoryWord(a = address(TPI,TRIGGER));
b[8] = tpi.FIFO0 = stl->ReadMemoryWord(a = address(TPI,FIFO0));
b[9] = tpi.ITATBCTR2= stl->ReadMemoryWord(a = address(TPI,ITATBCTR2));
b[10] = tpi.FIFO1 = stl->ReadMemoryWord(a = address(TPI,FIFO1));
b[11] = tpi.ITATBCTR0 = stl->ReadMemoryWord(a = address(TPI,ITATBCTR0));
b[12] = tpi.ITCTRL = stl->ReadMemoryWord(a = address(TPI,ITCTRL));
b[13] = tpi.CLAIMSET = stl->ReadMemoryWord(a = address(TPI,CLAIMSET));
b[14] = tpi.CLAIMCLR = stl->ReadMemoryWord(a = address(TPI,CLAIMCLR));
static QStringList lst;
if (lst.isEmpty())
{
lst << "SSPSR" << "CSPSR" << "ACPR" << "SPPR" << "FFSR";
lst << "FFCR" << "FSCR" << "TRIGGER" << "FIFO0" << "ITATBCTR2";
lst << "FIFO1" << "ITATBCTR0" << "ITCTRL" << "CLAIMSET" << "CLAIMCLR";
}
return printTable(&tpi_alt,&tpi,sizeof(tpi),b,lst);
}
开发者ID:kubanecxxx,项目名称:kstlink,代码行数:33,代码来源:cm3debugregs.cpp
示例17: extractMismatches
// processing lines with mismatches
void extractMismatches(string reads, string baseQuals, int cov,
string transcriptID, string mispos,
string ref, int qualThreshold, int coverageThreshold)
{
int start = 0, end = 0, i = 0;
baseCounter counter;
counter["A"] = 0;
counter["C"] = 0;
counter["T"] = 0;
counter["G"] = 0;
counter["N"] = 0;
counter["a"] = 0;
counter["c"] = 0;
counter["t"] = 0;
counter["g"] = 0;
counter["n"] = 0;
int qual;
int insertion = 0, deletion = 0, current = 0;
string strand = "+";
fixpileup(counter, deletion, insertion, reads, baseQuals,
ref, qualThreshold, cov, start, end);
cov = cov - counter["N"] - counter["n"];
assert(cov == counter["A"] + counter["C"] + counter["G"] + counter["T"] +
counter["a"] + counter["c"] + counter["g"] + counter["t"]);
if (cov > coverageThreshold)
{
printTable(transcriptID, mispos, ref, cov,
insertion, deletion, counter);
}
}
开发者ID:wckdouglas,项目名称:filterSamFile,代码行数:32,代码来源:pileupBases.cpp
示例18: toggle_on_click
void toggle_on_click(int x, int y)
{
char buffer[10];
int i, j;
int startx = START_X;
int starty = START_Y;
if(result == TRUE)
{
return;
}
for(i=0; i<SIZE+1; i++)
{
if(x > (startx - X_INCR/2) && x < (startx + X_INCR/2))
break;
startx += X_INCR;
}
if( i >= (SIZE+1) ) return;
for(j=0; j<SIZE+1; j++)
{
if(y > (starty - Y_INCR/2) && y < (starty + Y_INCR/2))
break;
starty += Y_INCR;
}
if( j >= (SIZE+1) ) return;
i--; j--;
toggle_neighbours(i, j);
printTable(SIZE, SIZE);
}
开发者ID:joshyjoseph,项目名称:lights_off,代码行数:33,代码来源:lights_off.c
示例19: main
int main()
{
int x, y, c;
MEVENT event;
initscr();
curs_set(1);
keypad(stdscr, TRUE);
mousemask(ALL_MOUSE_EVENTS, NULL);
initTable();
printTable(SIZE, SIZE);
while (result == FALSE)
{
c = wgetch(stdscr);
if (KEY_MOUSE == c)
{
if (OK == getmouse(&event))
{
x = event.x;
y = event.y;
toggle_on_click(x, y);
}
}
}
start_color();
init_pair(1, COLOR_GREEN, COLOR_RED);
attron(COLOR_PAIR(1));
printw("Wow You Win....");
getch();
endwin();
return 0;
}
开发者ID:joshyjoseph,项目名称:lights_off,代码行数:35,代码来源:lights_off.c
示例20: printReport
void printReport(Table const *table, char const *name)
{
char const func_char = table->f == my_f ? f_charrep : g_charrep;
char const *func_str = table->f == my_f ? f_strrep : g_strrep;
printf("\n%s for %c(x) = %s on [%Lf, %Lf]\n", name, func_char, func_str, min_x, max_x);
printTable(table);
long double const error_coeff = (table->f == my_f ? error_coeff_f : error_coeff_g)(table->xs.size);
long double const step = (max_x - min_x) / numof_checkpoints;
long double curr_x = min_x;
long double max_error = 0.0;
long double max_upperbound = 0.0;
Polynomial polynomial;
makeLagrangePolynomial(&polynomial, table);
printf("Ln(%c, x) = ", func_char);
printPolynomial(&polynomial, stdout);
printf("\n\nNo | x | %c(x) | Ln(%c, x) | error | A | error <= A\n", func_char, func_char);
printf("---+--------------+--------------+------------------+------------------+------------------------+-----------\n");
for (size_t i = 1; i <= numof_checkpoints; ++i) {
long double const x = curr_x + frand() * step;
long double const y = table->f(x);
long double const lagrange = lagrangeValue(table, x);
assert(fabsl(calcValue(&polynomial, x) - lagrange) < 1.e-6);
long double const error = fabsl(y - lagrange);
long double const error_upperbound = errorUpperbound(table, x, error_coeff);
printf("%2zu | %+.9Lf | %+.9Lf | %+16.9Lf | %+16.9Lf | %+22.9Lf | %s\n"
, i, x, y, lagrange, error, error_upperbound, error <= error_upperbound ? "Yes" : "No");
curr_x += step;
max_error = error > max_error ? error : max_error;
max_upperbound = error_upperbound > max_upperbound ? error_upperbound : max_upperbound;
}
printf("\nmax error = %+.9Lf\nmax A = %+.9Lf\n\n", max_error, max_upperbound);
disposePolynomial(&polynomial);
}
开发者ID:ramntry,项目名称:numerical_analysis,代码行数:35,代码来源:main.c
注:本文中的printTable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论