c++ biginner plz help.....?
114514
I have the answer.\n\nYou should change the numbers to be "400.0" instead of "400". This is your primary problem.\n\nThe deeper reason that this is happening is that 400*400/400 is an INTEGER expression. It will be evaluated as an integer, and only assigned to a floating point result.\n\nI believe that your compiler is a 16 bit compiler, this is the only answer that makes sense.\n\nNow let's just see what the compiler is doing. Its first step is to evaluate 400*400. Now if you get out your calculator, you will get the answer 160,000. NOT SO FAST!!!! An integer in your compiler is only 16 bits long, and can only express numbers between -32768 and 32767. The answer that it comes up with is 28,928 (160,000 - 2*65,536). It will next divide 28,928 by 400 to give 72 (again it drops the fractional result because it is integer).\n\nIn both C and C++, the result of an integer expression is an integer. It does not matter if it gets assigned to a float or not. If you want float accuracy, then the numbers in the expression must be floats.
142433
you havn't closed "void determinecost (...)" function with curly braces " } "\n\nin c++, you have to close any block of code with } that has been opened with {
1158232
#include <iostream>\nusing namespace std;\n\nvoid main ()\n{\nint countDown= 0;\n\ncout <<"Enter the number you want to start from: ";\ncin >>countDown;\n\nfor ( countDown; countDown >= 0; countDown--)\n      cout <<countDown<<", ";\n}\n\nAny other question, just ask, eoroxter@gmail.com\nGood Luck,
618947
#include <iostream> \n#include <cstdlib> \n#include <iomanip> \n\nint make_odd(int h); \nvoid rec_call(char c, int s); \n\n\nint main( void) \n{ \n    cout << "Enter character to use in the diamond.&#92;t"; \n    char draw; \n    cin >> draw; \n    cin.ignore(1000, '&#92;n'); \n    cout << "How many rows in the diamond (make it an odd number)?&#92;t"; \n    int high; \n    cin >> high; \n    cin.ignore(1000, '&#92;n'); \n    high = (high % 2)? (high/2) + 1 : make_odd(high); \n    rec_call(draw, high); \n    cout << "&#92;n&#92;nPress Enter to Continue . . .&#92;t"; \n    cin.get(); \n    return 0; \n\n\n\n} \n\n\nint make_odd(int h) \n{ \n cout << "That is not an odd number&#92;nUsing " << (h + 1); \n return ((h / 2) + 1); \n\n\n} \n\n\nvoid rec_call(char c, int s)  // c = char to print s = rows to print \n{ \n static int i = 0; \n while(i < s) \n { \n      int width = s + i; \n      int len = 1 + (2 * i); \n      char temp[len + 1]; \n      for(int count = 0; count < len; count++) \n              temp[count] = c; \n      temp[len] = '&#92;0'; \n      cout << endl << setw(width) << temp; \n      i++; \n      rec_call(c, s); \n      if(i == s) \n      { \n         i++; \n         return; \n      } \n\n      cout << endl << setw(width) << temp; \n  } \n\n\n\n}
751588
Sorry.... i guess ur question a lil tricky.... Well i am C++ prog and work on the VC++ platform...
1141235
Uh.. you didn't say, but it looks like you're using an older Borland product.  This is prbably not going to work well unless you are using an old version of MS-DOS.  It won't like it much under most memory models in a Windows console environment without special treatment.  Try double checking the memory model specified in the project and run it from a boot disk with DOS on it would be the only way this would work out most times.  Better to try using the C++ new and delete keywords to manage memory.  I hope that this helps.
12275
Follow this link:\n\nhttp://www.thefreecountry.com/compilers/cpp.shtml\n\n:)
24430
It's a memory leak.  A type of bug.  When the program uses a section of memory, it never gives it up when its done - so eventually it expands to include all of your usable space.\n\nFile a bug complaint and wait for a patch.
346423
check out http://www.planet-source-code.com - I don't do C++, but I use that site all the time, and it has great examples in source code form.
983919
Here you go\nhttp://www.thefreecountry.com/compilers/cpp.shtml\n///
83035
#define __TEST__\n\n#include <stdio.h>\n\n#ifdef __TEST__\n#include <conio.h>\n#include <stdlib.h>\n#endif\n#define STACKSIZE 64\n\n\nint stack[STACKSIZE];\nstatic int stack_ptr=0;\n\nvoid overflow_test( int pos )\n{\nif( pos >= STACKSIZE )\n{\nputs( "Stack overflow!&#92;n" );\nexit(1);\n}\n}\n\nvoid underflow_test( int pos )\n{\nif( pos < 0 )\n{\nputs( "Stack underflow!&#92;n" );\nexit(1);\n}\n}\n\nvoid push( int value )\n{\noverflow_test( stack_ptr+1 );\nstack[stack_ptr++] = value;\n}\n\nint pop( void )\n{\nunderflow_test( --stack_ptr );\nreturn stack[stack_ptr];\n}\n\n#ifdef __TEST__\n\nvoid wait4keypress( void )\n{\nwhile( !kbhit())\n;\n}\n\nint main( void )\n{\natexit(wait4keypress); \npush(1);\npush(2);\npush(3);\nprintf( "%d&#92;n", pop());\nprintf( "%d&#92;n", pop());\nprintf( "%d&#92;n", pop());\n/* must cause stack underflow */\nprintf( "%d&#92;n", pop());\nreturn 0;\n}\n\n#endif  /* __TEST__ */
1178151
If you know max.allowed width, use \nprintf( "%*.*s", width, width, arr[idx] )\n\nvoid printArray( char ** strings, int arr_sz, int columns, int min_width )\n{\nint rows = arr_sz/columns;\nfor( row = 0; row < rows, row++ )\nfor( col = 0; col < columns; col++ )\n{\n     int idx = columns*row+col;\n     if( idx >= arr_sz )\n           break;\n     printf( "%*.*s&#92;t", min_width, min_width , arr[idx] );\n}\nprintf( "&#92;n" );\n}
903121
Try Bloodshed Software's version of C/C++ instead.  It's free just like Turbo C from Borland.\n\nhttp://www.bloodshed.net/devcpp.html
649070
Your problem is that you are creating a vector of objects, when you really want to create a vector of pointers to those objects:\n\nvector <ClassName *> vecSouth;\n\nThen the following should work:\n\nvecSouth.push_back(new CLassName("images/menu.bmp", 1));\n\nsince the new is returning a pointer to a ClassName.  The only way to make your original version work would be to dereference the new'ed value.\n\nvecSouth->push_back(*(new ClassName.....));\n\nNote that it's usually preferable to have your containers store pointers to things vs copies of things (to avoid having multiple copies of objects and to avoid any confusion/ambiguity about exactly what is being stored.  Though you could have a reason to want to store copies, again, just be sure you're straight in your mind as to exactly what you want to do.
930756
#include<iostream>\nusing namespace::std\n\nvoid main(){\ncout<<"Plz enter a number"<<endl;\nint x;\ncin>>x;\nif(x!=4)\n{\ncout<<"Well Done"<<endl;\n}\nelse {\ncout<<"The Number You Entered is 4"<<endl;\n}\n\n};\n\nI GUESS THIS IS WHAT YOU MEAN. YOU DONT NEED A BOOLEAN OPERATOR IN THIS CASE.
1135646
Your best bet is to google the topic. I have done this for C++ and found numerous sources that detail the language. Try C++ file extensions, and then search. This should bring up sources that will have the info you need.
374089
It has 2-bytes code, so you need to examine two consequent bytes. It is not C++ specific, it is PC-specific.