0

I am quite new to C++ and have looked at tutorials online for figuring out how to code all of these functions I have made. This is for an assignment, and I am not asking for any assistance in my coding as I am still planning on revising that later and doing a final run of error checks.

What I am seeking assistance with is that unlike Java, which I am used to, C++ uses header files. I'm not quite sure of the importance of them but for my assignment, and from what I have seen online they are required.

An example of part of my code is:

int getStringLength(string inputString)
{
int length;
length = size(inputString);
return length;
}

int main()
{
string testCase1 = getStringLength("Hello world!");
print(testCase1);

cin.get();
return 0;
}

How would I go about fixing my *.cpp file and using my current code so it's implemented into a *.h file?

Thanks

TMP4
  • 23
  • 5
  • Thanks for providing the similar question, I am happy to have this closed and if possible I would like to give you a "answered" tag. – TMP4 Apr 02 '16 at 05:31
  • I'd be tempted to reopen, the link, while correct leans towards C. If the OP is using C++ and hasn't tagged the question as C I think a more C++ like answer should be provided. We have enough people thinking their programming in C++ while programming in C. – Harry Apr 02 '16 at 06:13
  • I am programming in cpp using Visual Studio 2015, but I feel that I have been able to adapt what T.C. provided to my situation. I can always provide an additional comment if it fails to help me. – TMP4 Apr 03 '16 at 07:30

0 Answers0