| | |
I need help please
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2006
Posts: 1
Reputation:
Solved Threads: 0
I need help in writing a fuction call delete_repeats that has a partially filled array of chararcters as a formal parameter and that delets all repeted letters from the array. It should also have two formal parameters: an array parameter and a formal parameter of type int that gives the number of array position used and when the letters are deleted the remaining letters are moved forward to fill in the gap. So far this is what I have :
im very lost in this
c Syntax (Toggle Plain Text)
const max=30; char used [max]; cout<<"Type in a word"; cin>>word; for (int i=0;i<size-1; i++) for (int j=i+1; j<size; j++) if (word[i]==word[j]) delete_repeat( ) void delet_repeat(char w[ ],int size) { for (s=j;s<size-1;s++) { word[s]=word[s+1] }
im very lost in this
Last edited by ~s.o.s~; Nov 30th, 2006 at 12:27 pm. Reason: Added code tags learn to use them yourself.
•
•
Join Date: Aug 2005
Posts: 14
Reputation:
Solved Threads: 3
lets say you have
char sMyString[6];
0 1 2 3 4 5
[A] [R] [R] [A] [Y] [\0]
you call delete_repeats ( sMyString, 0 );
so basically you want to delete A at position 3, but you cant just move everything to the right of it to the left. that would be too easy... think of a way to copy or move the positions after your target letter to the left ...
char sMyString[6];
0 1 2 3 4 5
[A] [R] [R] [A] [Y] [\0]
you call delete_repeats ( sMyString, 0 );
so basically you want to delete A at position 3, but you cant just move everything to the right of it to the left. that would be too easy... think of a way to copy or move the positions after your target letter to the left ...
![]() |
Other Threads in the C++ Forum
- Previous Thread: What does *&p do?
- Next Thread: PLZ HELP!!..I WANNA write a prog forcomparing n concatenating strings using POINTERS
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamic dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library linker list loop looping loops map math matrix memory microsoft newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings struct temperature template templates test text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






