Course Solutions Uncategorized (Solved) : Please Help C Code Need Print Number Digits Total Characters Number Letter Using Pointer P Q28127733 . . . .

(Solved) : Please Help C Code Need Print Number Digits Total Characters Number Letter Using Pointer P Q28127733 . . . .

 

Please help me with this c++ code. I need to print out thenumber of digits,total characters, and number of letter usingpointer. In particular, I’m having a hard time initializing thecharacter array. I have my code here.

#include <iostream>
#include <string>

using namespace std;

void getStatistics(char sentence[], int* noOfChars,int*noOfDigits,int* noOfAlphabets);

int main()
{
int noOfChars;
int noOfDigits;
int noOfAlphabets;
string sentence = “”;
int stringLen = 0;
cout<< “Enter a sentence to analyze:”;
cin >> sentence;
  
char* sen[] = new char[sentence.length()-1];
  
for(int i = 0; i < sentence.length()-1; i++){
sen[i] = &sentence[i];
}
getStatistics(sen,&noOfChars,&noOfDigits,&noOfAlphabets);
  
cout<< noOfChars << endl;
cout<< noOfDigits << endl;
cout<< noOfAlphabets << endl;
  
  
return 0;
}

void getStatistics(char sentence[], int* noOfChars,int*noOfDigits,int* noOfAlphabets){
  
for(int i =0; i <sizeof(sentence)/sizeof(sentence[0]);i++){
if((sentence[i] >= 97 && sentence[i] <= 122)

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post