Hi, I'm pretty new to C++ and basically pretty new to all programming at all, have done something in java in school but never been programming something else than some scripts in work until now.
My problem now is when I try to compile this code I have here then I get a error's who are.
(17) : error C3861: 'count': identifier not found
(29) : error C2664: 'strlen' : cannot convert parameter 1 from 'char' to 'const char *'
What my assignment is to make a code that takes a text string and put's it through a function which returns me the number of chars in the text.
Here is the code I have now.
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char pszString[256];
int size = 0;
cout << "Write a text that is under 256 characters" << endl;
cin >> pszString;
size = count(pszString);
cout << "Your text is " << size << " characters long.";
cin >> pszString;
return 0;
}
int count ( char pszString )
{
int size;
size = strlen(pszString);
return (size);
}
I hope you can help my something I will keep working on this and post in another code if I get something more working. I have let the code work without using a seperate function for the strlen argument.