Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Assume the array of char pointers char * A[4] // fill it with {"welcome to c++II", "see the powerfull of pointers" , "work hard", "Good Luck"}

1.Write a function to reverse the array

2.Write a function to reverse a selected line

3.Write a function to print the most repeated character in the array.

4.Write a function that returns a string of all vowel characters in the array.



i need to solve this equation with function using pointers
please any one could solve it


What I have tried:

I tried to solve the problem but I cannot write the code correctly
Posted
Updated 19-Dec-20 5:46am

Quote:
please any one could solve it

Yes, anyone of us could solve it: it's not a complicated piece of homework, and it really wouldn't take very long at all.

But ... While we are more than willing to help those that are stuck: that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Comments
mousa131201 19-Dec-20 12:10pm    
I tried the first two but I don’t know if it’s true or not
I don't know what to write in main
#include <iostream>
using namespace std;

void revArr(char* A[], int size){
char* tmp;
int j = size - 1;
for (int i = 0; i < size; i++){
tmp = A[i];
A[i] = A[j];
A[j] = tmp;
j--;
}
}

void printRev(char* A[], int line){
line -= 1;
int size = 0;
while(A[line][size] != '\0'){
size++;
}
while(--size >= 0){
cout << A[line][size];
}
cout << endl;
}
OriginalGriff 19-Dec-20 14:00pm    
Well ... you could try calling the functions ... :D
mousa131201 19-Dec-20 15:21pm    
this is right or not

main()
{
char * A[4]={"welcome to c++II", "see the powerfull of pointers" , "work hard", "Good Luck"};

cout<
OriginalGriff 19-Dec-20 15:22pm    
Try it and see ... I can't even read more than three lines ...
Patrice T 19-Dec-20 18:32pm    
Use Improve question to update your question.
So that everyone can pay attention to this information.
C++
char * A[4] = { "welcome to c++II", "see the powerfull of pointers" , "work hard", "Good Luck"};

// use a temporary pointer to access any string:
char* stringOne = A[0];

Stop and think about the requirements of each function. How would you reverse the array, do you need a copy of the array or can you rearrange its contents in place? Sometimes it helps to draw things on paper and try to visualise each step in the process.

Try the first function, and when you have that working go on to the next one.
 
Share this answer
 
Comments
CPallini 19-Dec-20 13:18pm    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900