alright, so here's what I got:
#include <stdio.h>
main()
{
int s;
int splus;
//snext = s+1;
while ((s = getchar()) != EOF)
{
if (s == '/' && splus == '/')
{
//remove code
while ((s = getchar()) != '\n')
{
putchar(' ');
/*should replace all text I wanted to replace with empty spaces*/
s++;
/*should increment counter*/
}
}
s++;
}
}
After that, I'm pretty lost...I read somewhere else that I should copy the file character by character into a new file, then stop copying and just read anywhere there's a // or /*, and start again when I see */, but I'm having trouble figuring out how to do that since we haven't been over it in class yet. I do have some *working* code, but I'm loath to use it since a section of it (a modified function called "getline(void)") isn't of my own design, and I'm trying to be ethical here. Any words of advice? Am I even on the right track? Can you at least see where I was going with this code? Thanks.
#include <stdio.h>
main()
{
int s;
int splus;
//snext = s+1;
while ((s = getchar()) != EOF)
{
if (s == '/' && splus == '/')
{
//remove code
while ((s = getchar()) != '\n')
{
putchar(' ');
/*should replace all text I wanted to replace with empty spaces*/
s++;
/*should increment counter*/
}
}
s++;
}
}
After that, I'm pretty lost...I read somewhere else that I should copy the file character by character into a new file, then stop copying and just read anywhere there's a // or /*, and start again when I see */, but I'm having trouble figuring out how to do that since we haven't been over it in class yet. I do have some *working* code, but I'm loath to use it since a section of it (a modified function called "getline(void)") isn't of my own design, and I'm trying to be ethical here. Any words of advice? Am I even on the right track? Can you at least see where I was going with this code? Thanks.