i was asked this ques by a senior.\nanswer is very simple letz see if som1 can answer it. \nNOTE: dont use any operators \nPLS write the whole program
122145
You say don't use any operators, but that pretty much makes almost every program impossible.  I assume that you don't care about some of the "other" operators that include the stream insertion operators for inputting and outputting results, the function call operator, and the member operator, at the very least.  List of operators:\nhttp://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B\n\nIf you only want to restrict the use of +/-, here's someone that wrote an adder that sort of simulates how it's done in hardware, but he uses lots of bitshift and bitwise operators:\nhttp://www.devmaster.net/forums/showthread.php?t=1727\n\nHere's my little solution, which doesn't even utilize assignment or comparison operators, though it isn't very useful for adding large numbers since it allocates memory then just looks at how much is allocated.\n\n\n#include <iostream>\n#include <string>\nusing namespace std;\n\nint main(void)\n{\n   int a, b;\n   string sum;\n\n   cin >> a >> b;\n   sum.resize(a, 'z');\n   sum.append(b, 'z');\n   cout << sum.size() << endl;\n   return 0;\n}\n// it wouldn't let me indent when I pasted...
546297
hi,\ndo loop is first excecute the task and then its check the condition.\n\ntime 1:\n---------\nd=0, i=20.\n\nd=d+(1.0/i)\nd=0+(1.0/20)\nso new d=0.05\n\nand at the same time,\ni=i/(-2)\nso new i=20/(-2)\nnew i=(-10)\n\nnow the d=0.05\nand i=(-10)\n\nand then its check the condition.\ni<5\n(-10) < 5 is true\nso it wil run the loop again,\n\nso nw come to the 2nd level...\n\nTime 2:\n----------\nd=d+(1.0/i)\nso d=0.05+ (1.0 /(-10)\nnew d =0.05+ (-0.1)\nnew d=0.05-0.1\nd= (-0.05)\n\nand concider abt i,\ni=i/(-2)\ni=(-10)/(-2)\nso new i = (+5)\n\nnow lets checks the condition,\ni < 5\n+5 < 5 is fals, \nso the program s terminated.\n\nso now the value of d= (-0.05)\n\nr u clear?\nthis is a gud egsample for tha do while loop,\nHav fun bro,\ntc.
173180
I'd dump it into a compiler and do it for you but you left too much out.  Impossible to return a syntax error free version without the whole program.\n\nAnyways, I get paid for this.  How many points is this worth?  ...to do someone's homework for him?  Or maybe he's doing contract work!  He's getting $70 and hour to let us do it for him!
380360
I don't see how you could access elements in an array past MAXINT. (Using array syntax.)\n\nSo the practical answer is MAXINT.
50958
The code below will work.\n\nint main()\n{\nint aNum,i;\ncout<<"enter a number";\ncin>> aNum;\nfor(i=0;i<aNum;i++)\n{\nfor(j=0;j<=i;j++)//nested loop\ncout<<"*";// end of nested loop\ncout<<'&#92;n';\n}// end of outer loop\nreturn 0;\n}
219563
Well, they both take a lot of time! And, I must see the algorithm of (....;)! When both take a lot of time, We should check the one which takes the less time! If both takes the same time, we should choose the one which takes less space (Memory space I mean) But generally, Prefer the 2nd one! I think we should try to use a general code or function in the second choice! If there isn't a general rule, then, I prefer using the 1st one, cause it takes less memory and the lines of codes will be less I suppose...
5684
°  Hey it works!!  Hold alt key and enter 248 on number pad... 38°...it works...wow..I taught myself something. It's a shortcut to ASCI coding.
309171
ok, here is one declaration, of many;\n\nfloat Doc(int arr[100], int NumCt)\n{\nfloat sum = 0.0;\nfor (int i = 0; i < NumCt; i++)\nsum += arr[i];\n\nif (!NumCt)\nreturn sum;\n\nreturn sum / NumCt;\n}
67034
int\nmain (void)\n{\nfor(i=0;i<10;i++){\nprintf("some thing output here %d", i)\n}\n}
247208
you have to use instinct, there is no clear rules that states what the expressions must look like (except if the problem insist you on giving the answer in a specific form). \n\nPerhaps one of the guidelines is make variables that have same indices grouped into one. So x + 3x becomes 4x, group them out don't leave them straying.
207092
There's a very explicit algorithm which explains\nhow to handle number, operators (including left\nor right precedence), functions, etc. on the \nWikipedia site for RPN (see reference #1).\n\nMostly, it's very straight-forward.  If it's an operand\n(ie. a number), then push it on the stack.  If it's an\noperator, then pop off as many operands are needed and\nevaluate.\n\nBut do look at the full algorithm for the details.\n\nOh yeah, for a full-blown implementation, see the source\ncode to the Unix "dc" (desk calculator) program.  The\nSolaris source is at reference #2.
271664
Here is a great article with sample problems.\n\nHope this helps!
298240
Joel, you need some help.  This is one of the easiest questions I have ever heard!  You should know this, man!  You're gonna fail your test if you keep cheating on here and don't actually figure out how it works.  Good luck, brotha'\n\nL = -2 or L(x) = -2
673
I haven't tried it, but check out MatPy (linked below).  Another possibility is Numerical Python (also linked below).
58482
- -----------O\n------------ . .-----------  _\n  K+ ( O: Mn  :O )\n-------------. .\n------------ O\n\nomit the long dotted lines
70669
just try this out:\n\nfor(couter=n; counter>=0; counter--)\n{\n   printf("&#92;n %d", counter);\n   sleep(1000); //or might be Sleep(1000) \n   //check out delay() also in place of sleep()\n   //sleep(1) suggests a delay of 1 millisecond\n}\nprintf("&#92;n That is..!");\n\n\n----------\nI think tht shud be simple n sweet. :-)\n\nI think the answerer below really needs to refer back to his expert programming.. as sleep takes milliseconds only.
97487
Check out the following thread (i.e., including the replies / followups)\n\nhttp://gcc.gnu.org/ml/gcc-help/2003-01/msg00058.html