I am a c++ noob who is still learning things like structs and classes. However, I want to write a simple program that makes a small change to an XML file. I've googled the matter a little bit, but...
Type: Posts; User: nick753
I am a c++ noob who is still learning things like structs and classes. However, I want to write a simple program that makes a small change to an XML file. I've googled the matter a little bit, but...
Shouldn't it just be char output[] ?
I think my version is much easier, thanks for trying to help though!
void remove(char cstring[], char letter)
{
int j = 0;
int i ;
for( i = 0; cstring[i] != '\0'; i++ )
{
I just can't get it, how can I push back all of the characters after the space of the removed characters? I tried finding it in my book, and there is nothing like that. I tried looking online and...
How would I copy the next valid character to a specific spot?
By replacing them with their neighbors you mean pushing back all the characters after the space that were left? And I would do this with the 2nd char array?
Here is my attempt at doing that, but it is giving me spaces where the letter used to be when I cout the 2nd array.
for(int i = 0; cstring[i] != '\0'; i++)
{
if(cstring[i] !=...
Isn't there a way that I can store all of the letters that are != to letter into another char array? That is what I was hoping to do with strcpy.
I have been trying to create an algorithm for about 3 hours now and nothing I do works. I don't know what to do.
should I set last to strlen? Like this
last = strlen(cstring)
??
This will work with the way my program is set up now? Also, this will work if I have to delete character 4, 5, and 11?
Can you give me some idea how to do that?
I got it to work like this
void remove(char cstring[], char letter)
{
char cstring2[55];
for(int i = 0; cstring[i] != '\0'; i++)
{
if(cstring[i] != letter) cout << cstring[i];
I am tryin gto make a program that allows the user to enter a string as a character array and a letter to delete from the array. I am having a very hard time deleting the letter from the array. The...
He says he doesn't have a compiler yet guys, jeez. He just wants someone to explain why the else will be executed.
Anyway, the else will be executed if the two values are equal because the if...
Ok now how is the i%j logic working? Say i is 4, then j would be 3 right? 4%3 does not equal 0 right? And when i is 6, wouldn't j be 5? Then 6%5 would not equal 0 either? What am I missing?
So how does the inner loop ever first get executed since i and j are both set to 2? Does the outer loop get executed first, then the inner loop starts? I just don't understand how the inner loop...
I came across this code to find prime numbers and I don't quite understand the nested for loop. Can someone explain exactly how it works? If i and j both = 2, then how does j increment when j < i...
Was this to me or nimitzhunter?:confused: Now I'm getting even more confused!
Okay, but is there a obvious reason as to why my method is not working? To just take the last card dealt and put it at the end of the array then decrement the pointer down one each time a card is...
Do you mean fill the array with the random numbers? That's not really what I am supposed to do. I am supposed to fill the array from 0-51 then add the randomness when I deal the card. Then after...
No matter what I try NOTHING seems to work when it comes to trying to making my program not deal the same card twice! I am hoping someone can point me to the right direction with this! The first way...
Okay, I think I got this working pretty much like it's supposed to. The one thing that is sort of stumping me, however, is the shuffle function. To shuffle, I was thinking of just allowing all of...
Jeez, you guys always find something to pick at. Who gives a flying .......... if I have a brace not indented while trying to help out a new programmer!!? The point was to show him how a loop could...
Wow, that sure is a lot of code to do a simple task! Have you learned about loops yet? You can loop the output and input so you won't need the if statements and other code.
Check this out
...