Multiple inputs on one line

Yes, you can input multiple items from cin, using exactly the syntax you describe. The result is essentially identical to: This is due to a technique called “operator chaining”. Each call to operator>>(istream&, T) (where T is some arbitrary type) returns a reference to its first argument. So cin >> a returns cin, which can … Read more

Using cin to input a single letter into a char

You are not inputting or outputting the characters correctly. char letter[2] is an array of 2 characters, not a single character. You want char letter. Further, you are outputting letter[2], which is the third element of an array that only has two values (indexing in C++ starts from 0; the first element is letter[0] and … Read more

How to delete a specific line in a file?

First, open the file and get all your lines from the file. Then reopen the file in write mode and write your lines back, except for the line you want to delete: You need to strip(“\n”) the newline character in the comparison because if your file doesn’t end with a newline character the very last … Read more

C++ – pointer being freed was not allocated error

Welcome to the exciting world of C++! Short answer: you’re passing Store as a value. All your menu functions should take a Store& or Store* instead. When you’re passing Store as a value then an implicit copy is done (so the mainStore variable is never actually modified). When you return from the function the Store::~Store … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)