Thread: Can i replace this with just this

  1. #1
    Registered User
    Join Date
    May 2019
    Posts
    47

    Exclamation Can i replace this with just this

    Hello friends,
    I am new to c++ and was studying the code of a bank record system

    where
    they have used
    Code:
    #include<iostream>#include<fstream>
    #include<cstdlib>
    using std::cout;
    using std::cin;
    using std::endl;
    using std::fstream;
    using std::ofstream;
    using std::ifstream;
    using std::ios;
    can i just use in place of that? or i am missing something?
    Code:
    #include<iostream>#include<fstream>
    #include<cstdlib>
    using namespace std;

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Yes, you can, but you may end up injecting more unqualified names into the scope than you expect, so you shouldn't unless you know what you're doing.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can C++ Replace PHP?
    By jamesjeffery in forum C++ Programming
    Replies: 20
    Last Post: 08-17-2009, 08:23 AM
  2. replace
    By sneha in forum C Programming
    Replies: 4
    Last Post: 06-12-2009, 09:05 AM
  3. String replace
    By guitarist809 in forum C++ Programming
    Replies: 2
    Last Post: 04-10-2008, 03:53 PM
  4. Using replace()
    By alvifarooq in forum C++ Programming
    Replies: 3
    Last Post: 11-06-2004, 04:34 PM
  5. Will .NET Replace COM/ActiveX?
    By Davros in forum C# Programming
    Replies: 3
    Last Post: 10-29-2002, 04:57 AM

Tags for this Thread