473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to run a c++ program using namespace

#include<iostream>
#include<conio>
nmaespace num
{
void disp(int x)
{
cout<<x;
}
}
void main()
{
num::disp(123);
getch();
}
Mar 18 '15 #1
1 1425
weaknessforcats
9,208 Expert Mod 8TB
Your code looks correct. However, since you are not using namespace std, you will need to call std::cout.

BTW: main() returns an int.
Mar 18 '15 #2

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

Similar topics

5
by: cppaddict | last post by:
It is typical to put the line: using namespace std; at the top of a file which makes use of std library objects. To take a simple example: #include <iostream> using namespace std;
5
by: Peng Yu | last post by:
For example, at the beginning of the C++ program, I say "using namespace std;" However, in the middle of the program, I want to disable "using namespace std;". Do you know how to do that? ...
8
by: Petter Reinholdtsen | last post by:
I ran into a problem on HP-UX 11.00 the other day, where it refused to compile a program using 'using namespace std;' at the top. The reason seem to be that the compiler refuses to accept 'using...
5
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
4
by: Teddy | last post by:
If I use just a STL container such as std::vector in my program. Is "using std::vector;" better than "using namespace std" ? Does "using namespace std" cost ?
6
by: AlexD_UK | last post by:
When I create a new C++ project of type "Class Library (.NET)", I am unable to then add the following line of code : using namespace std If I do, I get the following error on compilation :...
7
by: zahy[dot]bnaya[At]gmail[dot]com | last post by:
Hi all, Since I am always confusing this, I want to know once and for all what is the right way of doing this. I've noticed that some programs use: std::cout<< "yadayada"<<endl;
30
by: Pep | last post by:
Is it best to include the code "using namespace std;" in the source or should each keyword in the std namespace be qualified by the namespace tag, such as std::cout << "using std namespace" <<...
3
by: Schizoid Man | last post by:
Hi, I'm a novice whose just about migrating to C++ after cutting my teeth on C for a few years. To start with I'm using Microsoft's out-of-the-box Visual C++ Express Edition compiler and I...
6
by: Juha Nieminen | last post by:
Whenever one sees example C++ code basically anywhere, be it in a book, in a tutorial in the internet, in an online forum or whatever, I would estimate that at least in 99% of cases one sees the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.