Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include<iostream> #include<cctype> using namespace std; void stringupper(char*)

ID: 3610868 • Letter: #

Question

#include<iostream>

#include<cctype>

using namespace std;

void stringupper(char*);

int countchar(const char*,char)

int main()

{

char strgl[]="fdsgnsdfgsdg";

char *ptr_strgl=strgl,ch='G';

stringupper(ptr_strgl);

cout<<"The letter"<<ch<<" appears"

<<countchar(ptr_strgl,ch)<<" times in the string "

<<ptr_strgl<<endl;

return 0;

}

int countchar(const char*ptr_strg, char ch)

{

int cnt(0);

while(*ptr_strg)

{

if(*ptr_strg == ch)

cnt++;

ptr_strg++;

}

return cnt;

}

Explanation / Answer

#include #include #include main() {     int found = 0;     char data[30];     char *data_ptr =data;           char choice;     char *choice_ptr;     choice_ptr = &choice;     coutdata;        coutchoice;           for(int i = 0; i