Posts

formatting - C - Printing formatted output of money -

in program print out table, 1 of columns has money listed. want print out money values neatly , right justified , below: $9.00 $8.00 $19.20 $200.90 i can right justify numbers so while(condition) { printf("$%5.2f\n", number); } but method $ isn't positioned want it, , output more like: $ 9.00 $ 8.00 $ 19.20 $ 200.90 can formatting want printf ? you can auxiliary string: while(condition) { char str[10] = {}; sprintf(str, "$%.2f", number); printf("%8s\n", str); }

'None' in python -

i have simple program above creates bst sorted array. should parse tree without showing leaves none. explain why program still spits out 'none'. i'm python noob , appreciate help.i have tried != 'none' along none same results. class node: def __init__(self,value): self.value=value self.nodeleft=none self.noderight=none def makebst(ia,start,end,tree): if (end < start): return none mid = (start + end) / 2 n = node(ia[mid]) n.nodeleft = makebst(ia, start, mid-1, tree) n.noderight = makebst(ia, mid+1, end, tree) tree.append(n) return n def printbst(root): print 'rr' ,root.value if root.nodeleft == none: print 'eot' else: print printbst(root.nodeleft) if root.noderight == none: print 'eot' else: print printbst(root.noderight) if __name__ == '__main__': array = [1, 2, 3, 4, 5, 6] dic = [] root ...

function - How to manipulate the Global Variable in C -

i have multiple void functions relies on each individual output of functions since there multiple variables (that same throughout code), each functions' output "stored" them , passed another. so, decided make variables global variables making them static .... right after necessary #include... codes. i able utilize functions (14 functions in total,all void ) calling 4 of them (each functions, after processing own function, passes result function , after series of passing, 4 of them needed called in int main() ) now, created void function requires global variables parameter since void function relies on data other functions "copied , put" global variables declared earlier. (which found not working, since heard storing data global variables not possible.) can teach me if there other way create series of functions requires output of each individual functions? i checked if variables stored properly, tried using printf method right after #3 process...

c# - Adding Text Changed Event for Grid View Cell -

one column of gridview contains textbox , want add textchanged event text box in grid view. i think you're looking datagridview.cellbeginedit event

google cast - Is ChromeCast only for Video? -

can chromecast and/or google cast protocol run apps not video? in other words, possible create html5 app runs on chromecast , controlled smartphone/tablet? yes, receiver arbitrary html5 application. of course, should make sure it's suitable displayed on tv no attached keyboard , mouse, etc. see google cast receiver documentation more detail.

Concantenating strings in Javascript -

new javascript. code below, looking @ 2nd paragraph in particular...if var str = "sting equality test..." + stra, why 2nd, 3rd lines etc not output same output plus own line? edit sorry not explaining - wondering why code (once have cleaned up) doesn't produce first line (of 2nd paragraph) repeated, plus whatever state in 2nd , 3rd lines etc. don;t need to, exercise, don't understand. seems though should function init() { var stra = "javascript" === "javascript" ; var strb = "javascript" === "javascript" ; var flt = 7.5 === 7.5 ; var inta = 8 !== 8 ; var intb = 24 > 12 ; var intc = 24 < 12 ; var intd = 24 <= 24 ; var str = "string equality test: " + stra ; str += "<br>string equality test 2: " + strb ; str += "<br>float equality test: " ; + strc ; str += "<br>integer inequality test: " + inta ; str += "<br>greater test: " + intb ; str += ...

c++ - What means the error : ..."bytes to alignment boundary" in Xcode/Clang? -

transformnode 4 bytes alignment boundary and here code cause warning : class transformnode : public node { public: int number; public: void test() { number = 12; } }; //node.h class node { public: typedef std::set<node *> childset; protected: childset mchildren; node * mparent; public: node(node * parent=0) : mparent(parent) {} ~node() {} node * addchild(node * node); inline node * getparent() { return mparent; } const childset &getchildren() const { return mchildren; } }; inline void node_test() { transformnode * node = new transformnode; node->test(); std::cout << node->number << "\n"; } int main() { node_test(); return 0; } the error happens when derive node class class transformnode. using xcode 5.0 warnings turned on , treating warnings errors. want understand going on code, turning off warnings or stop treating them errors not way want handle this. edit: added...