473,465 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't use container - stack, help me!

AnhtuanA
3 New Member
Expand|Select|Wrap|Line Numbers
  1. #include <stack.h>
  2.  
  3.  
  4. stack <int> intStack;
  5.  
  6. void main(){
  7. intStack.push(1);
  8. intStack.push(2);
  9. intStack.push(3);
  10. }
When I compile this code by Turbo C++, the error is "can't include stack.h"
How can I use this container?
Nov 4 '06 #1
5 1776
Ganon11
3,652 Recognized Expert Specialist
Try

Expand|Select|Wrap|Line Numbers
  1. #include "stack.h"
Nov 4 '06 #2
AnhtuanA
3 New Member
Try

Expand|Select|Wrap|Line Numbers
  1. #include "stack.h"
No effect (T_T)
Nov 8 '06 #3
sonic
40 New Member
I'm fairly new to C++, but you may try:

#include <stack>

Goodluck!
Nov 8 '06 #4
sicarie
4,677 Recognized Expert Moderator Specialist
I'm fairly new to C++, but you may try:

#include <stack>

Goodluck!
In C++, any declaration other than '#include <stack>' will have an error that says it is a deprecated library. Either of the other two will probably work in C.

I believe your problem is that you have no 'main' statement. You don't even declare a stack, you just start pushing values on it.

Try initializing a stack in a main statement

Expand|Select|Wrap|Line Numbers
  1. #include <stack>
  2. using namespace std;
  3. int main() {
  4.    Stack intStack;
  5.    return 0;
  6. }
  7.  
Probably not exactly like that - they had $15 table toppers tonight, but if you google '#include <stack>' I'm sure you can figure it out.
Nov 8 '06 #5
AnhtuanA
3 New Member
My teacher said that Turbo C++ don't support this style of include.
#include <stack> just can be used in VC++
Nov 12 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: William Payne | last post by:
Hello, have you seen a recent files menu in a GUI application? In many GUI applications there's a menu the displays the most recent files that has been opened by the program. Say such a menu has...
7
by: gipsy boy | last post by:
I made a Stack structure, as an exercise on templates. Stack ll; Is this used irl? : "ll << o" to push an object pointer to the end of the list and "ll >> &o" to push it off and save the address...
2
by: Michael Olea | last post by:
Hiya. Frequently (as in at least twice now) I find that when I write some sort of container I want at least two out of three possible versions: o fixed max size known at compile time o fixed...
2
by: wubin_98 | last post by:
Hi All, Could any expert point out what is wrong in my code? I search around but couldn't found answer. It seems that I am the first person have this problem. Thanks in advanced I have a...
5
by: Anjo Gasa | last post by:
Let's say I have: std::vector<Object> rgObjects; rgObjects itself is declared as a local variable and hence on the stack. But what about as I add elements to rgObjects: Object newObject( 3,...
4
by: sandeep | last post by:
When we use STL which memory space it will use whither it is stack or heap or data segment How to make STL to create in heap? How to make whole container to create in heap? I think container...
3
by: Michael | last post by:
Hi, Could you please explain a little bit about the difference between the following two groups. group 1: std::vector std::deque std::list group 2: std::stack std::queue std::priority_queue ...
9
by: OuaisBla | last post by:
Although STL container can't support object by reference as a template argument. To make thing worse, allocator can't support stack based allocation. So: std::deque<std::string const &> is...
18
by: tech | last post by:
Hi, i have a std::vector of pointers to base classes say std::vector<element*m_elements; how do i make the followin exception safe function() { element* e= new DerivedElement;...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.