Question: Here is an example of how you separate your code into different files add the header file and the .cpp file to the project. ------------------------------------------------------------------

Here is an example of how you separate your code into different files add the header file and the .cpp file to the project. ------------------------------------------------------------------ //Header file -- saved as ex1.hpp #pragma once

class ex1 { public: ...ex1(){} ...void print(); }; ------------------------------------------------------------------ //.cpp file -- saved as ex1.cpp #include "ex1.hpp" #include void ex1::print() { ...std::cout<<"Hello"< } ------------------------------------------------------------------ //main -- saved as main.cpp #include "ex1.hpp" int main(void) { ...ex1 e(); ...e.print(); ...return 0; } ------------------------------------------------------------------ Why do I have the #pragma once in the .hpp file?

second question

I have seen my share of x,n and i variable names. My general rule of thumb is that the length of a variable name is proportional to the length of it's scope. I.e., big function = big variable name. Would you agree?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!