Pastey Giving 110%
- Posted by irv Mar 16, 2019
include GtkEngine.e include std/math.e constant instructions = `markup= <b>Ever been asked to 'give more than 100%' to your job?</b> Haven't we all? But did you ever wonder what that means? Is it even possible? This program contains mathemetical proof that it is! Select a word from the list below then click the OK button to see what is required in order to exceed 100%. `, -- see the simple but surprisingly accurate mathematical formula on line 55; effort = {"Genius","Knowledge","Hardwork","Attitude","Politics", {66,117,108,108,115,104,105,116}, {65,115,115,75,105,115,115,105,110,103} }, win = create(GtkWindow,"title=BossWords,size=300x200,border=10,$destroy=Quit"), pan = create(GtkBox,"orientation=vertical,spacing=10"), inp1 = create(GtkComboBoxText), inp2 = create(GtkEntry,"$activate=OK"), lbl1 = create(GtkLabel,instructions), lbl2 = create(GtkLabel,"or enter a word below to see how close to 110% you can get"), box = create(GtkButtonBox), btn1 = create(GtkButton,"gtk-quit","Quit"), btn2 = create(GtkButton,"gtk-ok","OK") add(win,pan) add(inp1,effort) add(pan,{lbl1,inp1,lbl2,inp2}) add(box,{btn1,btn2}) pack_end(pan,box) show_all(win) main() global function Col2(object a, object b) return compare(a[2],b[2]) end function ---------------------------- global function OK(atom x)-- ---------------------------- object word if x = inp2 then word = upper(get(inp2,"text")) else word = upper(get(inp1,"active text")) end if integer total = sum(word-64) return Info(,,word,sprintf("will get you <b><big>%d%%</big></b>,",total)) end function


