What is Stack overflow ?




In software, a stack overflow occurs if the call stack pointer exceeds the stack bound. The call stack may consist of a limited amount of address space, often determined at the start of the program. The size of the call stack depends on many factors, including the programming language, machine architecture, multi-threading, and amount of available memory. When a program attempts to use more space than is available on the call stack (that is, when it attempts to access memory beyond the call stack's bounds, which is essentially a buffer overflow), the stack is said to overflow, typically resulting in a program crash.


Post @stack overflow : 


c++ question, please help me figure this out, thank ...

Question: C++ question, Please help me figure this out, than...



C++ question, Please help me figure this out, thank You!

Write a class named 'TransportationMode' with two member variables that are NOT public, int wheels, and float mph.

Include necessary Constructors and two functions:

float timeToDestination(float miles); // Returns a float in terms of hours of how long it takes to travel given the current mode of transportations mph

void sayModeOfTransportation(); --> Should say exactly "I am traveling on an unknown mode of transportation."

Write two more classes, Car and Bike that inherit from TransportationMode.

These should have no member variables. Make the constructor for each such that Bikes have 2 wheels and travel at 15.0 mph, and cars have 4 wheels and travel at 60.0 mph.

Each of the derived class should overload the function 'void sayModeOfTransportation()' and instead cout..

"I am traveling on a bike."

"I am traveling in a car."

Don't overload the timeToDestination method.

Finally, the TransportationMode class should have a friend function named getWheels that takes a TransportationMode object as a parameter. You should declare this inside the class BUT as is the case with a friend function, you should define it outside of the class. You should not create any getter or setter functions to accomplish this.

Video @stack overflow : 

https://www.youtube.com/watch?v=KBk-ayp6yyU




questions and answers For computer science :

write a program to print out the numbers 10 through 49 in the following manner



Write a program to print out the numbers 10 through 49 in the following manner:
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
How would you do it? Here is an example of poorly written code:
for ( int i = 10; i < 50; i++ ) {
     switch (i) {
     case 19:
     case 29:
     case 39:
System.out.println(" " + i); // move to the next line
           Break;
     default: System.out.print(" " + i);
     }
   }
This code is not written well because it works only for printing 10 through 49. Try to develop the code so that it can be extended easily to handle any range of values. You can do this coding in two ways: with a nested-for statement or with modulo arithmetic. (If you divide a number by 10 and the remainder is 9, then the number is 9, 19, 29, or 39, and so forth.)