It's saying I have 6 errors. Need help, please..or a push into the right direction. Thank-you. :)

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

int Len_String(char *);
int CountCapitals(char *);
int CountVowels(char *);
int main()
{
   char msg[] = "Strayer - what a University !";
   char msg2[] = "Programming is a Challenge";
   cout << msg << strlen(msg) << endl;
   cout << msg << Len_String(msg) << endl;
   cout << msg << CountCapitals(msg) << endl;
   cout << msg << CountVowels(msg) << endl;
   cout << msg2 << strlen(msg2) << endl;
   cout << msg2 << Len_String(msg2) << endl;
   cout << msg2 << CountCapitals(msg2) << endl;
   cout << msg2 << CountVowels(msg2) << endl;
   return 0;
}
int Len_String(char *p) 
{
	int line (char *p)

	cout << "Enter a line of characters: " << endl;
	cin.getline()
	
	
   int length;
   int *ch_ptr;
   while (*char_p != '\0')
   {
	 ++length;
	 ++ch_ptr;
   }
   return length;

}//End of Len_String()
int CountCapitals(char *p) 
{
   int length = 0;
   int *ch_ptr;
   cout << "Enter a line of CountCharacters: " <<endl;
   while (*ch_ptr ! = '\0')
   {
	++count;
	++ch_ptr;
   }
}//End of Len_String()

int CountVowels(char *p)   
{ 
int length = 0;
int *ch_ptr;
cout << "Enter a line of CountVowels: " <<endl;
	 while (*ch_ptr ! = '\0')
	 {
	++count;
	++ch_ptr;
	 }
}//End of Len_String()

You are incrementing pointers that are not initialized.

Thank-you, I figured that much....will continue to work on it...later.

If anyone else has input..it would be appreciated.

Thank-you, I figured that much....will continue to work on it...later.

If anyone else has input..it would be appreciated.

Code tags.

[code]

// code here

[/code]

Take the errors one by one. Some are obvious:

int line (char *p)

What's this?

cin.getline()

Where does the data go? Look up getline and see what parameters it requires. Your call must match the spec.

okay, I've rewritten it..
still working on it, thank-you for your insight.

How does it look now?

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

int Len_String(char *);
int CountCapitals(char *);
int CountVowels(char *);
int main()
{
char msg[] = "Strayer - what a University !";
char msg2[] = "Programming is a Challenge";
cout << msg << strlen(msg) << endl;
cout << msg << Len_String(msg) << endl;
cout << msg << CountCapitals(msg) << endl;
cout << msg << CountVowels(msg) << endl;
cout << msg2 << strlen(msg2) << endl;
cout << msg2 << Len_String(msg2) << endl;
cout << msg2 << CountCapitals(msg2) << endl;
cout << msg2 << CountVowels(msg2) << endl;
return 0;
}
int Len_String(char *p) 
{
	
int length = 0;
while (*ch_p !='\0')
{

	++length;
	++ch_p;
}
return length;

}//End of Len_String()

int CountCapitals(char *p) 
{
int length = 0;
int *ch_p;

while (*ch_p ! = '\0')
{
++count;
++ch_p;
}
}//End of Len_String()

int CountVowels(char *p) 
{ 
int length = 0;
int *ch_p;

while (*ch_p ! = '\0')
{
++count;
++ch_p;
}
}//End of Len_String()

I rewrote it...any input would be helpful.....I have two errors now and it say's:
'ch_p' : undeclared identifier

It's causing me a headache, I must say.

and it say's: 'ch_p' : undeclared identifier

So in this piece of code:

int Len_String(char *p) 
{
	
int length = 0;
while (*ch_p !='\0')

Where exactly did you declare ch_p?

I guess I didn't every time I try I end up with more errors.

Errors:-

1. In function Len_String(char *p) ---- int line (char *p) is useless. Remove it.
2. In function Len_String(char *p) ----*char_p is undefined. Probably it should be *p (typo error)
3. In function CountCapitals(char *p) ---- while (*ch_ptr ! = '\0'). There should be no sapce between ! and =
4. In function CountVowels(char *p) ---- while (*ch_ptr ! = '\0'). There should be no sapce between ! and =

An updated version, now I have to figure out the "CountVowels" part of my code.
Whomever looks for this problem, I hope this helps you...I see most respondent here don't help, and when u comment on that they give you negative reviews. To those that are here to really help, that aren't smart AlEc's... thank-you.


My code currently:

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

int Len_String(char *);
int CountCapitals(char *);
int CountVowels(char *);
int main()
{
char msg[] = "Strayer - what a University !";
char msg2[] = "Programming is a Challenge";
cout << msg << strlen(msg) << endl;
cout << msg << Len_String(msg) << endl;
cout << msg << CountCapitals(msg) << endl;
cout << msg << CountVowels(msg) << endl;
cout << msg2 << strlen(msg2) << endl;
cout << msg2 << Len_String(msg2) << endl;
cout << msg2 << CountCapitals(msg2) << endl;
cout << msg2 << CountVowels(msg2) << endl;
return 0;
}
int Len_String(char* ch_ptr) 
{
int length = 0;
while (*ch_ptr != '\0')
{
	++length;
	++ch_ptr;
}
return length;

}//End of Len_String()

int CountCapitals(char* ch_ptr) 
{
int upper_count = 0;
while (*ch_ptr != '\0')
{
 isupper(*ch_ptr);
{
 ++upper_count;
}
return upper_count;
   
}// End of CountCapitals()

int CountVowels(char* ch_ptr) 
{
int CountVowels = 0;
while (*ch_ptr != '\0')
{
if(ch_ptr =[a] || ch_ptr = [e] || ch_ptr = [i] || ch_ptr = [o]|| ch_ptr = [u])
}
++count;
++vowels;
{

return CountVowels();

}

Errors:-

1. In function Len_String(char *p) ---- int line (char *p) is useless. Remove it.
2. In function Len_String(char *p) ----*char_p is undefined. Probably it should be *p (typo error)
3. In function CountCapitals(char *p) ---- while (*ch_ptr ! = '\0'). There should be no sapce between ! and =
4. In function CountVowels(char *p) ---- while (*ch_ptr ! = '\0'). There should be no sapce between ! and =

Thank-you.

Whomever looks for this problem, I hope this helps you...I see most respondent here don't help, and when u comment on that they give you negative reviews. To those that are here to really help, that aren't smart AlEc's... thank-you.

I'm guessing "most repondents" is referring to me. Since the OP decided to bring it up in an unrelated thread, I'll link it. People can decide for themselves whether they want to help this guy.

http://www.daniweb.com/forums/thread269341.html

<deleted> Posted in wrong thread

Luckychap
Thank-you very much...It was a typo.
ch_p
is supposed to be ch_ptr
I've re-written it....
Will post a reprise of my program....today.

#include <iostream>
#include <cctype>
using namespace std;
int Len_String(char *);
int CountCapitals(char *);
int CountVowels(char *);
int main()
{
char msg[] = "Strayer - what a University !";
char msg2[] = "Programming is a Challenge";
cout << msg << strlen(msg) << endl;
cout << msg << Len_String(msg) << endl;
cout << msg << CountCapitals(msg) << endl;
cout << msg << CountVowels(msg) << endl;
cout << msg2 << strlen(msg2) << endl;
cout << msg2 << Len_String(msg2) << endl;
cout << msg2 << CountCapitals(msg2) << endl;
cout << msg2 << CountVowels(msg2) << endl;
return 0;
}
int Len_String(char* ch_ptr) 
{
int length = 0;
while (*ch_ptr != '\0')
{
    ++length;
    ++ch_ptr;
}
return length;

}//End of Len_String()

int CountCapitals(char* ch_ptr) 
{
   int upper_count = 0;
   while (*ch_ptr != '\0')
   {
      isupper(*ch_ptr);
      {
         ++upper_count;
      }
   return upper_count;

   }  // End of CountCapitals()
}
int CountVowels(char* ch_ptr) 
{
int vowel_count = 0;
while (*ch_ptr != '\0')
{
 if ((*ch_ptr) == 'a'||(*ch_ptr) == 'A')
 ++vowel_count;
 else if ((*ch_ptr) == 'e'||(*ch_ptr) == 'E')
 ++vowel_count;
 else if ((*ch_ptr) == 'i'||(*ch_ptr) == 'I')
 ++vowel_count;
 else if ((*ch_ptr) == 'o'||(*ch_ptr) == 'O')
 ++vowel_count;
 else if ((*ch_ptr) == 'u'||(*ch_ptr) == 'U')
 ++vowel_count;
 else if ((*ch_ptr) == 'y'||(*ch_ptr) == 'Y')
 ++vowel_count;
++ch_ptr;
   }
return vowel_count;
}

SOLVED IT....The program succeeds but the debugging process takes a minute to execute.

start quote:

int CountCapitals(char* ch_ptr) 
{
   int upper_count = 0;
   while (*ch_ptr != '\0')
   {
      isupper(*ch_ptr);
      {
         ++upper_count;
      }
   return upper_count;

   }  // End of CountCapitals()
}

SOLVED IT....The program succeeds but the debugging process takes a minute to execute.

Not solved I guess so. Look at the above function, its not doing what is suppose to do(no increment of ch_ptr).

By the way what is 'debugging process' and how it is executed?

Wrong post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.