MosaicFuneral 812 Nearly a Posting Virtuoso

Finish pre-Algebra.

MosaicFuneral 812 Nearly a Posting Virtuoso

Actually in C++ it's just istream.getline(array_name, block_size); , or with strings getline(istream, string_name); .

Also don't you need strncat() to append data? You would also probably need a 2D array to hold multiple strings.

MosaicFuneral 812 Nearly a Posting Virtuoso

@nitu: Do you know how to use any other bit-operators?

@ajay: I believe you mean, computer. Regs are for brief usage, not storage.

MosaicFuneral 812 Nearly a Posting Virtuoso

When a compiler says, "Missing/Expected semicolon/operator before whatever", is really an euphemism for the vague meme, "You're doing it wrong!"(not to be rude)

You're missing the std namespace. std::cout << endl; , or after including your templates and classes, using namespace std; which means you wouldn't have to use std::cout .

edit:
Just follow what Zalezog said.

MosaicFuneral 812 Nearly a Posting Virtuoso

Looking at reviews, people either seem to say, "It's pure babbeling crap," or, "It's a masterpiece." Never read it.

Just go through your local libraries catalog and they might have a plenitude of books to look through.
We also have a list of challenges in a sticky a few post up.

MosaicFuneral 812 Nearly a Posting Virtuoso

More books on varied programming subjects, and just general practice apps.

MosaicFuneral 812 Nearly a Posting Virtuoso

If you're so new, then why are you trying a text editor?
Why not learn the basics first, or just Google one.

MosaicFuneral 812 Nearly a Posting Virtuoso

That was banned?
Suppose that's why I never see anymore.

MosaicFuneral 812 Nearly a Posting Virtuoso

Then he/she would learn nothing more than how to use iterators.

Salem commented: That might actually be an improvement ;) +27
MosaicFuneral 812 Nearly a Posting Virtuoso

You want, but it doesn't exist till you write it.

MosaicFuneral 812 Nearly a Posting Virtuoso

Here's the number one problem, the format!
A generic skeleton:

#include <iostream>
#include <cstdlib>

int main()
{
    string input;
    int      results[2], operation;
    bool   continue = true;

    srand(time(NULL));

    while(continue)
    {
         getline(cin, input);

        /*do stuff*/

         if(comparison is right)
             cout << "Correct.";
         else
         {
              /*Ask*/
         }
    }
    
    return(0);
}

Lets review.
One: Variable names you can read.
Two: srand() is called only once.
Three: Uses actual C++ classes.
Four: You can follow the flow.

MosaicFuneral 812 Nearly a Posting Virtuoso

First result from using Google, "C++ Permutations".
http://www.bearcave.com/random_hacks/permute.html

MosaicFuneral 812 Nearly a Posting Virtuoso

uhmmm, There's thousands of webgroups, e-zines and what-not all over online. You're looking in the wrong place, plus no-one will just willingly tell you their trade secrets.

If you're determined you would need to know: your taget OS's API to an exent, how to program, how to find exploits, how to use search engine.

MosaicFuneral 812 Nearly a Posting Virtuoso

Was this as an insult to you, or do they believe you have the skills?

MosaicFuneral 812 Nearly a Posting Virtuoso
MosaicFuneral 812 Nearly a Posting Virtuoso

They're for abruptly "breaking" loops.

MosaicFuneral 812 Nearly a Posting Virtuoso

No. No-one will write code for you, unless you're their respectable employer, teacher, or project partner.

First function is missing a semicolon.
Why do you declare and define another function inside of a function?
Why not use a container if you don't know how to use an array?
Why are you using the class keyword public?

You can also just check the right-most bit of a value, to see if it's an odd or even.

MosaicFuneral 812 Nearly a Posting Virtuoso
#define print(s) printf(s);

My eyes burn! :confused:

MosaicFuneral 812 Nearly a Posting Virtuoso

What on earth do you need a binary counter for in a tic tac toe game? Computers store everything in 8-bit binary. How you refer to the number doesn't make a difference, other than maybe speed.

They store it in binary yes, but we left the 8-bit addressing range many decades ago - even toys, and appliances have more than that! In the general computer market 32-bit is pretty standard, with a switch towards 64 becoming standard, soon.

MosaicFuneral 812 Nearly a Posting Virtuoso

Well this forum is pretty much expired, but you're only confused because of that bong, Towlie[dv1r].

MosaicFuneral 812 Nearly a Posting Virtuoso

There is no <vector.h>, just <vector> which includes all correct template headers in the bits directory.
Did you install Code::Blocks right, and setup up the default compiler?

MosaicFuneral 812 Nearly a Posting Virtuoso

Convert the string to evaluate to lower case, then use it.
I prefer if-else statments, of stings for input.

For ASCII
In a loop of string size:

if (is upper case(91< && 64>)) then
    swap_case()

Swap function:

function swap_case(&character)
    character XOR 32
MosaicFuneral 812 Nearly a Posting Virtuoso

http://www.relisoft.com/win32/index.htm

Create a window, draw a graph.

Freaky_Chris commented: Excellent link (+ I had lost it :( so thanks ) +3
MosaicFuneral 812 Nearly a Posting Virtuoso

Have you learned about practical use of loops to shorten(even speed up) code, or passing parameters instead of leaving things out in the global nowhere.

MosaicFuneral 812 Nearly a Posting Virtuoso

http://en.wikipedia.org/wiki/Permutation
http://regentsprep.org/regents/Math/permut/Lperm.htm

One way, start at zero and increase(i.e. ++variable; ), till you reaching the target.

MosaicFuneral 812 Nearly a Posting Virtuoso

What???

MosaicFuneral 812 Nearly a Posting Virtuoso

The first is that the planet and the start are going to orbit each other.
The second is that the planet is going to escape on a hyperbolic or parabolic orbit.

You can test the possiblity of either (a) or (b) by calculating the total energy required to separate the bodies to infinity, and the summing the kenetic energy. Obviously the P.E is

[tex]P.E= \int^\infty_d \frac{GmM}{r^2} [/tex]

[tex]P.E= \frac{GmM}{d}[/tex]

were d is the initial distance and I have replaced your F with the more common G.

I thought it was more like:

for ( if not roughly equivalent to r)
      v = sqrt(2 * G * r);

That's just what I remember from an old ref. book. Truthfully, this is a tad over my head.

MosaicFuneral 812 Nearly a Posting Virtuoso

Something like: #define LONG_MAX 2147483647L

MosaicFuneral 812 Nearly a Posting Virtuoso

Windows Console stuff(wincon.h) SetConsoleTitle("name");

MosaicFuneral 812 Nearly a Posting Virtuoso

No....
"Compiler Dir\Include\limits.h", just check the file with any flavor of text editor.

MosaicFuneral 812 Nearly a Posting Virtuoso

Did you check limits.h?

MosaicFuneral 812 Nearly a Posting Virtuoso

uhmm.. No.
Learn to code, or at least use a search engine.

MosaicFuneral 812 Nearly a Posting Virtuoso

So you want a program that generates a script, then executes a program that will interpret the script?

You need to work on how you ask things. Just like how your title has nothing to describe your predicament.

MosaicFuneral 812 Nearly a Posting Virtuoso

Except I doubt his authority, due to lack of English skills. And receiving an IP from admin; why should you be given that, Ron?

MosaicFuneral 812 Nearly a Posting Virtuoso

You tried to screw with a third element, but you only have the array set to [2].
It's also i < 3 not <=

MosaicFuneral 812 Nearly a Posting Virtuoso

This goes in header:

class FileHandler
{
    private:
                vector<string> lines;
    public:
                void open(const char *name, const int &mode);
}

Your code goes in C++ file:

void FileHandler::open(const char *name, const int &mode)
{
    //place it into vector
}

And as I said, try to leave questions in the forums, not PMs.

MosaicFuneral 812 Nearly a Posting Virtuoso

So a script interpreter?

MosaicFuneral 812 Nearly a Posting Virtuoso

One, site rule, CodeTags!!
Two, use functions void FileHandler::open(const char *name, const int &mode); .
Three, don't bother with eof(). Try, while(getline(file, line)) .

MosaicFuneral 812 Nearly a Posting Virtuoso

Just specify the datatype you want in the template parameter, from char to something like short, int, whatever.

MosaicFuneral 812 Nearly a Posting Virtuoso

Two threads up, as a Read Me sticky.

MosaicFuneral 812 Nearly a Posting Virtuoso

Like the concepts that are used for DVD players, we could rewind, go forward, and stop. Or could you get any other ideas how to solve it? Everyone, you might not see it but we are helping the great genius Einstein solve the problem of his theory.

DVDs are just a collection of static frames.

Why don't you just live in the now, I don't see any need to go back or forth. Whatever happens, happens. If the world explodes, oh well, like the rest of the universe could care.

MosaicFuneral 812 Nearly a Posting Virtuoso

It was towards you. Because you're trying to create an array of std::strings, which you don't need to. You can just dynamically append() data to a string instead of splitting it over arrays of strings(which you should allocate first). If you need a lot of strings like in choose use a container.

MosaicFuneral 812 Nearly a Posting Virtuoso
ifstream inFile;
vector<string> data;
inFile.open("File.txt");
while (!inFile.eof())
{
     string sString = inFile.getline();
     data.push_back(sString);
}

Don't bother with eof(), and don't put declarations in loops.
Simplified:

ifstream file("name");
vector<string> lines;
string str;

if(file.is_open())
{
    while(getline(file, str))
    {
         lines.push_back(str);
    }

    file.close();
}
else
{
    failed. set error events, logs, etc.
}
MosaicFuneral 812 Nearly a Posting Virtuoso

At first it sounds like you want a script interpreter, then a code generator; then a paradox almost or just weirdly written statements.

Interpreter = easy enough.
Code Generator = bit of challenge.
Compiler = lot of experience, or maybe get a degree in CS.

MosaicFuneral 812 Nearly a Posting Virtuoso

Do not declare things in a loop. Do it all before hand.
I think you're confusing std::string with a C style string, because you can just append things to the end without dealing with [] . Unless you plan on allocating them(no need with STL containers like vector).

MosaicFuneral 812 Nearly a Posting Virtuoso

Doesn't that show, that perhaps you should look at your problem till you're certain you can't solve it, before posting?

MosaicFuneral 812 Nearly a Posting Virtuoso

Why bother posting if you mark them solved two minutes latter?

MosaicFuneral 812 Nearly a Posting Virtuoso

As a side note it is also usually good to check if a file is open before attempting operations with the file usually something like

if (in.is_open())
{
while(getline(in, line)).... rest of code
}
else
cout << "Error Opening File\n";

That reminds, I don't see it closed after it's done.

MosaicFuneral 812 Nearly a Posting Virtuoso

Or use istringstream instead of atoi().
Just hope that there is a position after line Weapon_Damage.

MosaicFuneral 812 Nearly a Posting Virtuoso

getline as Yiuca said.

Never use macros like that. template <typename T> void input_cin(T variable);