.CPP - File Extension for C++ Source Files

Q

What is CPP? CPP, short name for C++, is used as the file extension for C++ Source files. .CPP files are text files that can be opened by Notepad or any text editors. See the sample .CPP file included below.

✍: FYIcenter.com

A

File Extension: .CPP

MIME Type: text/plain

File Content: C++ Source

.CPP files are C++ Source files, which contain C++ programming source codes. Here is a sample .CPP C++ Source file, mapInsert.cpp, containing some simple C++ statements:

#include <map>
#include <iostream>
using namespace std;

class Data {
public:
  Data(int val = 0) { mVal = val; }
  int getVal() const { return mVal; }
  void setVal(int val) {mVal = val; }

protected:
  int mVal;
};

int main(int argc, char** argv) {
  map<int, Data> dataMap;
  pair<map<int, Data>::iterator, bool> ret;

  ret = dataMap.insert(make_pair(1, Data(4)));
  if (ret.second) {
    cout << "Insert succeeded!\n";
  } else {
    cout << "Insert failed!\n";
  }
  
  ret = dataMap.insert(make_pair(1, Data(6)));
  if (ret.second) {
    cout << "Insert succeeded!\n";
  } else {
    cout << "Insert failed!\n";
  }
  return (0);
}

.CPP C++ Source file sample: Click sample.cpp to download.

Since .CPP text files are in text format, you can use Notepad or any text editor to create or modify them. No special software is needed.

For for information on how to use .CPP C++ Source files, see links below:

2012-07-08, 3165👍, 0💬