Oh, right. Thank you very much laserlight and hk_mp5kpdw! I had no problem with C but struggling with C++ objects and classes/structs, cant still fully understand the concept.
Type: Posts; User: vegan
Oh, right. Thank you very much laserlight and hk_mp5kpdw! I had no problem with C but struggling with C++ objects and classes/structs, cant still fully understand the concept.
Cool, thank you, I see now how I shouldve called it. But now compiler says that listlines was not declared but it is part of List.h, I dont understand.
Thank you, yes it has to loop but how do I call Line display? This way -> Line.display() const; isnt working and lineStr should be std::lineStr?
//Line.h
const int MAX_CHARS = 6;
struct Line {
bool set (int n, const char* str);
void display () const;
private:
off to bed.. thanks again you all)
suppose it is a long array and there are more than 7s. so say 01001 7 1010 7 01100 (i use spaces for clarity) supposed to be the same as 01001[000]1010[0000]01100[000] i.e. every time it hits 7 it...
thanks andrew and thank you all for trying))
7 is just a number it doesnt mean chunks of 8. 7 could be 3 or 4 as long as it not 0 or 1. yep, the code exits the loop because the rest of numbers supposed to be 0 so im not adding them cos...
yes quzah, i actually have three for loops, (1) entire array (2) chunks of 8. (3) when it hits 7. thats not the problem. i dont think anyone gets the problem. you think i just need to go through the...
the for loop must stop at 7, convert whatever 0s and 1s it collected, reset and start again after 7. if you skip 7 and continue converting then its gonna give a wrong output.
say first 8 is...
im sooo damn tired. all day at school finishing stupid ms server 2008 case study. whyyyyyy do i have to take this useless server course????? now i have no time for programming.
thanks andrew, but as i said that is not the problem, my original loop kinda does that. the problem is when the for loop hits number 7.
yea, i also kinda know what to needs to be done. the problem is with the actual code. i just learned arrays and strings two weeks ago, and i had no time to practice them.
what about this? i think i got the logic? but still needs tuning...?
if (array_01[m-1]==7){
m++;
for (n=0; n<8-p ;n++){
word[p+1]+=array_01[m]*d;
m++;
d=d/2;} printf("printing word -...
i-k supposed to represent the size of array. array01[34] is an example.
How?
say i have an array of integers:
int array01[34] = {0,1,0,0,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,0,1,7,0,0,1};
int word[10];
int d=128, j=0, m=0, k=0, n=0;
for...
Thank you!! Saved me two hours)
yep, they do look familiar. things like int fprintf(FILE *stream, const char *format, ...) easy for you to understand but not for me)) yet. what .... supposed to mean? i would have to spend a couple...
yep, you are right. if i had time i would find a better way to do it and i will def look into it but i need to submit my assignment soon and i also have a bunch of other assignments and stupid essays...
Thank you guys once again, I've searched half the internet looking for fscanf and fgets examples and couldn;t really find one that would help me. i just realized i shouldve prob searched for...
Thanks a lot TheBigH. if you made it work, then i should be able to make it work too. thanks everyone! PS. found the problem
semicolon is there in my original code, compiler compiles everything fine. it just doesn't print the string. for loop isnt working, it should work with or without \n in printf which is just to test...
thats not a problem, suppose it opened correctly. for loop is a problem...
say the file contains:
890809
8989
1343434324
4738294
im trying to read line by line and store each into separate arrays. not working...