DGPickett 20

Once you have the average, you need another loop that reviews the input against it and prints the desired items.

DGPickett 20

No comma before where in SQL.

DGPickett 20

Or better yet, make it an array of char*, since a double quoted literal value is a char pointer to a constant on the heap.

DGPickett 20

Not seeing a lot of morphine, just a loop, a few ints, some io!

DGPickett 20

identical switch within switch is just wrong, and printing inside swtch ouside any case is not at all nice.

DGPickett 20

More values than columns!

DGPickett 20

Generally, when you go to a web site without a valid timed login cookie, the server redirects you to the login page, possibly with a cookie or variable saying where to go (the original page) after login.

DGPickett 20

You need to track both the number of cells used (top for a stack) and the capacity (max cells allocated) so you know when to expand the container (stack). Evict your methods from the class, removing class:: and call it a struct.

DGPickett 20

Since auto resizing arrays are not there in c, not classes, you might want to use a linked list or realloc() a char[] to size.

DGPickett 20

If you open an output ofstream and use it not cout, the data is saved in a file.

DGPickett 20

If stick 3 runs the machine OK alone, then incompatibility is a strong possibility. However, there is usually one way things can work and an infinite number of ways they can be broken! It might be broken so it runs but messes up any and all other cards on the same bus. I recommend buying a completely identically spec'd set of ram sticks of the highest performance the cpu and motherboard support. The pairs can be of different sizes, but within the pairs they should match so they can be interlaced/channeled. Go for the max size your system supports. Parity and error correction, if supported, are nice but not required for most of us. Clean the fans, too! :D

DGPickett 20

Somehow, the last time i added an equals() to a JAVA List (not Set, as Set does not support lookup like List and Map), it got ignored. I wrote my own findXXX(). Your results may vary! I'd recheck, but it was in a student's work. I should write something to try again! Still not sure why Set does not want to support lookup. I suppose it meets some math ideal!

DGPickett 20

EOF check between read and write, use get() to pick up white space characters, getline() removes the lew line.

dgp@dgp-p6803w:~
$ myCC c++rw
dgp@dgp-p6803w:~
$ c++rw
Type in file name followed by the extention ".txt"
x.txt
File created.
Please enter text: 
hohoho
File Information: hohoho
dgp@dgp-p6803w:~
$ 

#include <iostream>
#include <fstream>
#include <sstream>
#include <string> 
using namespace std;
int main()
{
    cout << "Type in file name followed by the extention \".txt\"" << endl;
    string user_file;
    getline( cin, user_file );
    fstream file; //object of fstream class
   //opening file "sample.txt" in out(write) mode
    file.open(user_file, ios::out);
    if (!file)
    {
        cout << "Could not open file" << endl;
        return 0;
    }
    cout << "File created." << endl;
    //write text into file
    string user_input;
    cout << "Please enter text: \n";
    getline(cin, user_input);
    file << user_input << endl ;
    //cout << "For testing. User input is: " + user_input<< endl;
    file.close();//close the file
    //system("pause");
    //open file to be read
    file.open(user_file, ios::in);
    if (!file)
    {
        cout << "Could not open file" << endl;
        return 0;
    }
    char ch; //read character
    cout << "File Information: ";
    while ( true )
    {
        file.get( ch );
    if (file.eof())break;
        cout << ch;
    }
    file.close(); 
    return 0;
}

DGPickett 20

Lots of references on the dangers and costs of various equalities. This one seems very nice: https://www.mattzeunert.com/2016/01/28/javascript-deep-equal.html

DGPickett 20

Just like scanf() and the JAVA Scanner Class, when you >> the next string, int, double, char, etc., then it reads, initially skipping over white space, into the variable from input until it has what you want, and when it hits an incompatible character, like white space for a string, it pushes that character back into the IO buffer. http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/

So, your line feed gets pushed back and waits for the next cin call. This is way common, but you can just read a char or do getline() to flush out the linefeed, or do a cin.getline() for the file name, which discards the linefeed. http://www.cplusplus.com/reference/istream/istream/getline/

DGPickett 20

I have had good luck with:

"<HTML><HEAD><TITLE>My Title</TITLE>...</HEAD><BODY>...</BODY></HTML>"

DGPickett 20

Wow, I just write a service that runs the query and reformats the column titles and values into an HTML table. If I wanted it to be more spreadsheet-like, there are caned javascript bits out there to allow you to re-sort the table.

DGPickett 20

In a database, you can just keep the count of every part, and as the users take or return stock, the count changes. If you want to know about the activity, you can have a table of activities, which can either be the primary and the stock level is the sum of counts for any product from original inventory forward, or a trigger or acess procedure generated side table of history of changes to the stock table. More sophisticated systems tie invoices to stock changes, so you can return a whole order at once and similar nice additional behaviors.

DGPickett 20

The easiest thing is to write CSV files, which follow 4 simple rules: 1) cells are separated by a comma, 2) rows are separated by a cr-lf, 3) unless the comma or cr-lf is enclosed in double quotes, and 4) a doubled double quote is a double quote in a cell, not an enclosing double quote.

There are libraries that write excel files .xls or .xlsx, visual whatever, perl, c, JAVA. I would pipe to a supporting app if it was not linkable. One would think the xlsx, which is XML, would be easy to write, but MS!

DGPickett 20

Wow, can of 'sorts'. You need some sort of container, and there are others besides array: linked list, tree, hash table, skip list. Tree sorts as it adds, and even C has tsearch(). For small sets, you can delete the min value when you find and print it, and scan all for the min repeatedly. Fancier sorts often divide and conquor, as an array of N random numbers, is an array of N sorted lists of 1 item each, which can be merged into N/2 lists of 2 sorted items, and so on.

DGPickett 20

== is a shallow comparison, like shallow copy, true only if the refrences are identical, not the objects. http://adripofjavascript.com/blog/drips/object-equality-in-javascript.html JAVA and C++ also have this sort of limitation unless you overload the == operator or use a method, like compareTo, equals, and JAVAScript isEqual. JAVA Sets use object.equals(), which is furstrating as you cannot override with your own class.equals().

JamesCherrill commented: About as wrong as a post can be -3

DGPickett 20

There is consulting, where they run interference for you, freelance work, volunteer work, teaching, tutoring and open source collaboration to get your status up and your skills sharp.

DGPickett 20

Google sheets keeps track of all changes and who entered them, and allows multiple user concurrent access. An RDBMS app needs to know who is logged in to make changes, and could have a complete history as well as status (the latest history) rows and active (the status is active) rows. I once wrote a quick app like this, where active and status were just views of history, all churn ws insert, and so history was 100%, very handy in RAD. Later we added archival update/delete, where the original/deleted were copied to parallel tables, and undo/redo was supported. It had just a few tables: courses, students, teachers, and learning events where the three interacted. Later we added areas, which was nice until users deleted people to get them out of their area only to have them reappear when they were reactivated in their new area. Dead to me is not dead! :D

DGPickett 20

Hash tables are containers. Hashing creates an integer from other types, usually the characters of a key, where it represents the values and positions of those characters. One divides the hash by the bucket count to select a bucket, which is a simple container like linked list where you can search for a precise match. One item per bucket is unwise! The cost of a bucket is a pointer, or 4/8 bytes, so use lots of buckets. Mod-2 bucket counts can be mod by simple and-masking out the lower bits, and the bucket count can be doubled (linear hash table) but the misplaced copied items must be culled or tolerated. Non-mod-2 bucket counts may randomize better! Hash is faster than tree, hash generate/divide cost being less than log2 comparisons, but it is not sorted. Other containers are the skip list: a tree-linked-list hybrid, the trie (a tree with one level per key character), the array and the linked list. Each has its advantages. The linked list adds/expands cheaper. Array lists always know their size, but are expensive to add or delete intermediate values. Linked list search/delete/insert requires comparing half the items on average. Lists are often used as queues in multithreaded situations, and one needs to decide on a fixed size or expensive expansion times, anticipate locking costs, thread suspension costs.

rproffitt commented: I love this. Just the thing to read to a class and then hand out the quiz. +15

DGPickett 20

The join table to itself tactic is very good for converting rows to columns. There are other tricks you can use with aggregates and case statements.

DGPickett 20

The major methods for image reduction in size are compression, like in jpeg, and resampling. Resampling may take something like a weighted average, which can make things muddy, or select the pixels that are closest to the original position, a center-of-pixel strategy where a minor artifact may grow in relative size. Some strategies do some sort of avaraging that is center-biased. It is nice to keep the original around and generate all rsized images off it, as repeated resampling adds to the muddiness.

DGPickett 20

DHCP operates a pool of IPs for clients that need them. Usage is a bit worthless unless they stay assigned a long time. As noted, the mac from the ethernet layer is a better id.

DGPickett 20

The Securities/Stock trading crowd like c++ for the speed, and XWindows was there long before most others.

DGPickett 20

How do you teach those who fall off the official wagon?

DGPickett 20

The hollow diamond is about distance from center column and distance from center row; their sum s/b half the height to print. In this case, 3. So:

for ( int c = 0 ; c < 7 ; c++ ){
  for ( int r = 0 ; r < 7 ; r ++ ){
     If ( r + c == 3  || r - c == -3 || r + c ==  9 || r - c == 3 ){
        cout << ‘*’ ;
      }
    }

     cout << ‘\n’ ;
   }
// r + c goes from upper right to lower left
// r - c  goes from upper left to lower right
Reverend Jim commented: On Daniweb we strive to help. Doing someone's homework for them is not helping. -3