Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It has been happening probably every since you switch from vBulletin to this. I always thought it was just a normal behavior of the editor you use.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is inarray()? You have too much duplicate code in that function. This is the recommended way to write such functions, not that it does not call feof() at all, but relies on fgets to return NULL then end-of-file is reached.

else {

    while(fgets(word1, 30, fileIn) != NULL) {     //succeeding strings in next line
        initArray(word1);
        fgets(word1, 30, fileIn);
        printf("word1: %s\n", word1);

        len = strlen(word1);
        if(word1[len-1] == '\n')
            word1[strlen(word1)-1] = '\0';
    }
    fclose(fileIn);

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

A cat has 9 lives -- what has more than 9 lives?

Answer:

Frogs because they croak every night. (Duck Dynasty)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I've noticed similar problems quite often, so I got into the habbit of refreshing the page after pressing the "Submit your Reply" button. If I don't sometimers the edit I just made disappears. Refreshing the page seems to solve the problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to post the structure. Is left and right pointers to ITEMTREE structures?

but proposed code notice failure

You need to be more specific about the erors. compiler errors? If so, what are they? Runtime errors? What is the behavior of the program?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since you already use Linux you probably have use ls from the shell many times. Look at the man pages for ls and you will find all it's options. I'm sure there will be an option to list the modivied time as well as file name. You might have to sort the list by modified time yourself.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Not to mention the scientific tests done on Ghust Hunters TV show :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

run the ls command and redirect the output to a file or pipe.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can also do it with _stat()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

@mike so simply by using static in every function we mean that we want this variable to be related to the function only

No -- variables declared within a function are never visible to other functions, and they are auto destroyed as soon as the function returns to it's caller. Making variables within function static means that the variable will hold it's value from one function call to another, they are not destroyed when the function returns like non-static variables. You can easily prove this to yourself by running the following program

int foo()
{
   static int x = 0;
   cout << x << '\n';
   ++x;
}

int main()
{
   for(int i = 0; i < 10; i++)
      foo();
}

Now, run the same program again but this time remove the static keyword. You will see the value of x is always 0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You should just delete lines 24-34 and do everything within the same loop that begins on line 17. On line 21 you know you've found a vowel and the i loop counter is the position within the string of that vowel. So, all that is left for you to do is save the value of i in an array for the given vowel.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are using way to many unnecessary parentheses and duplicate code For example dodaj() can be simplified like below, where the allocation is only done once at the beginning of the function. No need to repeat the lines within the function.

void dodaj(lista **l, int n, char tab[])
{
    lista* newnode = (lista*) malloc(sizeof(lista));
    newnode->liczba = n;
    newnode->data = NULL;
    strcpy(newnode->napis, tab);
    newnode->next = NULL;
    if (*l == NULL)
    {
        *l = newnode;
    }
    else
    {
        lista *pom = *l;

        while (pom->next) pom = pom->next;

        pom->next = newnode;
    }
}

Since your program is not in English I have no idea what those function names mean -- they are just meaningless to me. For example what is dodajmiejsce() supposed to do?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I wouldn't use strtok(), just modify the code previously posted to keep track of the position of each vowel, the loop's i counter is the location within the string. Now all you have to do is add some arrays to save that value.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You will probably have to use two arrays, one array for the letter and within that an array of each location number. Something like this.

struct location
{
   char letter;
   vector<int> locationNumber;
};

vector<location> locations_array;

The above assumes you have studied std::vector in your class. If not, then maybe you can use linked lists instead of vector.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That's a microsoft compiler thing -- it supressed warning number 4996, which is a warning about deprecated functions. Just delete that line if you use another compiler.

how can we cout the locations

What do you mean by "locatins"? The vowel's position within the string? Such as there is an "a" in the 5th position of the string?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is there always just one number on a line, or can a line have more than one number? If only one number, then just count the number of lines in the file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

gotoxy is indeed a text mode function. You didn't say you wanted graphics mode so I assumed you wanted text mode. My error. I don't know enough about graphics.h to tell you what to do, I haven't used that compiler in over 20 years.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what about it??

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

He doesn't have any choice but to use that formula, his instructor gave it to him.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Where did you hide the Indorsement button? I can't find it anywhere.

Nevermind -- I figured it out. There used to be a button in the purple ribbon, but I guess you got rid of it probably because it was consuming too much realestate.

The list of people to endorse -- can you display then alphabetically? It's difficult to find a specific member when they are all in random order.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Also repeatedly doing b = b*(1.0F+(r/1200.0F)); is going to give you compond interest

I thought calculating compound interest was he whole idea of the assignment.

@Ancient Dragon just how did you get that text in red?

the Inline Code button does that, just highlight the text and hit Inline Code in the grey toolbar. It will also prevent the editor from changing the spacing, just as code button does.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think he's asking to change the font, just to input text at specific coordinates. All sahil needs are these two lines.

gotoxy(x,y)
fgets(text,sizeof(text),stdin);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you mean in this line num += (c - '0');

It is subtracting the ascii value of 0 (which if you look at any ascii table '0' has an ascii value of 48) from whateve is in c to convert from ascii to binary decimal. If the value of c is '0' then the equation c-'0' is 48-48 = 0.

For the char I intend to add the ascii value of each char and mod them, then store them in an array.

Why?? mod will not convert from ascii to numeric.

Not all lines will have numbers so is that possible?

use fgets() to read the entire line, then parse it. If some line have numbers and other lines don't, then using scanf() will not work because it will error out then %d is encountered. You'll just have to parse it manually to find out if a character is a numeric digit or something else.

The loop you posted on line 11 doesn't work because the value of c never changes. Don't blaim fgetc() for the bugs in your code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are no "theories" about life after death that can be observed or tested scientifically. Is there life after death? Your guess is as good as mine. My guess is no because no one in a million years or so of human existance has ever come back from the dead to tell us about it. Another reason is that I had an operation about 6 or 8 months ago, I blinked my eyes and it was all over, yet people who were there said that an hour or so had passed. I had no knowledge about the time I was under anastasia, I saw no white lights and I didn't see myself lying on the operating table -- I knew nothing. That's most likely what it is like to be dead.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First you have to create a project, that will generae a default *.cpp file. You can put your class there or add a *.h file to the project. You might want to read Getting Started page here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I got the same results when I tried it after I posted that reply.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

<deleted>

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to do math inside the loop that begins on line 17. The equation on line 15 is only for one month. The balance needs to be recalculated every month until it reaches the target amount.

The loop on line 17 it completly wrong -- n is the balanace after one month. You don't want to increment the balanace each loop but just increament a simple counter that counts the number of months from 0 to ??. I think a while loop would be easier for this assignment. Inside the loop you need to calculate the balance at the current month, b = b*(1.0F+(r/1200.0F));

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What is the error? Most likely vb6 programs are just too old to run on windows 8, but that is just my guess.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hope you enjoy your holiday :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

r/1200 is doing integer math which means all decimals are discarded. So 10/100 is 0 because 10 cannot be divided by 100. You can fix that in one of three ways

(1) Declare r as float instead of int, then use scanf("%f") instead of scanf("%d")

(2) Typecast either the numerator of denominator to float
(float)r/100

(3) Make 100 a float by adding decimal number, such as 100.0

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The first thing you need to do is to decide what you want to put in the file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are many kinds of databases: simple text files, binary files, and numerous SQL compliant databases such as MySQL (free). Which kind do you want to create?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Bummer! It would take a couple hundred years to reach puberty :) That would also mean I would have to raise my kids for several hundred years. Ohh Myyy.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Not that I know of, but you can get the text itself. The size of the rectangle would depend on the font being used.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm in much the same position as the Reverend, and I have to pay taxes on all my retirement pay; it isn't tax free.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ancient Dragon: Are you sure you're compiling as C and not C++? There are no VLAs in C++.

The code Mike posted is c++, not c. Hint: it used <vector>

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Where are examples 4 and 5???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would hope if life span were 1000 years then the retirement age would be something like 950. That also means all you young folks would never get jobs because there were so many old people still working.

It would also mean mankind would have to populate other planets so there would be enough room to hold all those people. Earth of already overpopulated, what would it be like if the life span were doubled or trippled?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Technically me can be correct as well :

Here are the rules, which are pretty much the same as you stated.

diafol commented: good link +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I only used it once -- to generate an HTML page from the results of SQL queries. Don't know why they wanted me to use c++ for that instead of PHP. I was on a team of about 100 programmers, some c, some web. I'm not a web programmer so I can't explain it. AFAIK PHP can access SQL, sometimes easier than c++.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I tested your code, and as it turns out "%1023[^\t\n]" is no different than "%1023s" because with %s scanf() stops converting when it encounters the first white space (space, tab, newline, and backspace).

In either event it still doesn't work right because offset is only being incremented by 1 which produces undesireable results. offset has to be incremented to the beginning of the next field.

void foo(const char* format)
{
    int offset = 0;
    char field[1024];
    char line [] = "now\tis the\t0123\t   time\n";
    while (sscanf(line + offset, format, field) == 1)
    {
        puts(field);
        if (line[offset] != '\0')
        {
            offset += strlen(field);
            while (isspace(line[offset]))
                ++offset;
        }
    }


}

int main()
{

    foo("%1023[^\t\n]");
    printf("\n\n\n");
    foo("%1023s");

}

and the results are

now
is the
0123
time



now
is
the
0123
time
Press any key to continue . . .
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, but only if you help yourself out. Please post the code you have attempted then we can answer questions you might have.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

c++ is used for a great deal more than web development. Most PC games and desktop apps are written in c++. c++ can also be used as CGI programs (google "CGI programming")

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Does this mean it is possible to study C FIRST and THEN 'add' C++ ?

You can study either in either order. C++ did not implement C 100%, there are a few differences.

if anything, is the significance of using an interpreter rather than a compiler ?

AFIK executation speed. It's a little like the difference between walking and riding in a car, they will both get you there but one will get you there a lot faster than the other.

Orwell Dev-C++:

It's nice only if you also like driving a Model-T automobile made 100 years ago.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I was going to test using Visual Studio 2014 to see how the results compared with yours. But VS won't even compile it due to this line

task_type tasks[total_sum / min_coin + 1]; // <- use VLA

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Traveling 200 miles in the UK would bring you to not only very different accents, but also a different pronunciation of the word iron

From what I understand, just travel across the street and you'll find different accents. The play/movie My Fair Lady was all about that.

To put "Me" at the end seems to correct and proper than of I,

It's "You and I" not "You and me" or "Me and you". Using the word me there just sounds and looks uneducated.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

don't you know how to use google?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Isn't that all explained in your textbook?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

For numbers you have to do a little more processing -- convert the ascii value of the char to binary then add it to an integer. This works for English language and standard ascii character set.

I have no idea what you intend to do with the number, but whatever it is you would do it when a space is encountered.

Note: You may have a end-of-file problem with this code because it might ignore the last character in the file. It's a lot easier to read the file on entire line at a time and then split it in memory.

int num = 0;
while ((c = fgetc(pFile)) != EOF)
{
   if( isspace(c) )
   {
      num = 0;  
   }
   else if( isdigit(c) )
   {
       num += (c - '0');
   }
   else
   {
       // neither a space or a digit
   }
}