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

What???

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

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

Two threads up, as a Read Me sticky.

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

They're for abruptly breaking out of loops, which beginners confuse with goto some reason(never use goto!).

MosaicFuneral 812 Nearly a Posting Virtuoso

uhmmm.... Get a compiler from this century. Strings are a million times easier than what you're doing now.

MosaicFuneral 812 Nearly a Posting Virtuoso
ofstream file("name", ios::app);

if(file.is_open())
{
    cout << "Opened." << endl;
    file << " appending data";

    file.close();
}
else
{
    cout << "\"Could not open file.\"" << endl;
}

cout << "Done.";
MosaicFuneral 812 Nearly a Posting Virtuoso

It's <iostream> not <iostream.h>, try <string> not the old C way.
By using string you can simplify it and create an easier to follow flow of code. http://www.cplusplus.com/reference/string/string/

And by the way, main() must return zero.

MosaicFuneral 812 Nearly a Posting Virtuoso

Just using the string vector as an example.

void B::push_back(string &str)
{
    array.push_back(str);
}

string B::get_string(int element)
{
    return(array[element]);
}

If you use a pointer it should be private(imo), allocated in the constructor, deallocated in the destructor, no direct-access. Just my paranoid way.

MosaicFuneral 812 Nearly a Posting Virtuoso

Don't use gotos, there is break; and things called functions.
Why are you closing it if it doesn't open?

Re-write it.

MosaicFuneral 812 Nearly a Posting Virtuoso

That's some dangerous looking code.

class B
{
    private:
                vector<string> array;
    public:
                void method_add(int &stuff, int more);
};

void B::method_add(int &stuff, int more)
{
    stuff += more;
}
class A
{
    private:
                B objectB;
    public:
                void  do_something(void);
};

void A::do_something(void)
{
    int a = 7, b = 9;

    objectB.method_add(a, b);
    cout << "A.do_something().a: " << a << endl;
}

I would suggest you look for some more class tutorials.

MosaicFuneral 812 Nearly a Posting Virtuoso

help here again... if i enter AaBbCc the output should be CcBbAa or cCbBaA.. but the output appears cbaCBA.. help!!! heres the code..

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<search.h>
//int joke(const void* x,const void* y);
void main()
{
   clrscr();
   char a[100],temp;
   cout<<"Enter string: ";
   cin>>a;
   for(int i=(strlen(a)-1);i>=0;i--)
      cout<<a[i];
   cout<<"\n\nLETTERS IN THE STRING: ";
   for(int b=0;b<(strlen(a)-1);b++)
   {
      for(int c=b+1;c<(strlen(a));c++)
      {
	 if(a[b]<a[c])
	 {
	    temp=a[b];
	    a[b]=a[c];
	    a[c]=temp;
	 }
      }
   }
   cout<<a;
   getch();
}

You need to clean up your coding habits -just a bit- to help yourself out, while working with it:
C++ files don't have .h, so it's <iostream>. Important to remember, since <string.h> is very different from <string>.
Also try C++'s string with built in functions of convenience.
Place your sorting method in a function to clear things up a tad.
Use newlines to space out parts of your code.
main() must return zero.
clrscr(), is that portable?

Now as Vernon recommended, just need to compare it in one case then flip it back keeping track of it with a boolean statement.

MosaicFuneral 812 Nearly a Posting Virtuoso

Or just:

ifstream file("name");
sting      str;

if(file.is_open())
{
    file >> str;

    file.close();
}

If you're parsing a string, then possibly substring it and use istringstream to place it into an int.

You'd probably also have to check the string size(counting till non-num found), and compare it to string.max_size().

MosaicFuneral 812 Nearly a Posting Virtuoso

Here goes your code. Its compiled.

Syed, did you read any-of the rules, before you even posted?

MosaicFuneral 812 Nearly a Posting Virtuoso

If it can't open it then why do you continue to use it afterward?

file open
if(is open)
{
  do stuff
  close
}
else
{
   print "Error"
}

You're also missing a return.

MosaicFuneral 812 Nearly a Posting Virtuoso

Site rules "CODE TAGS".
Few things wrong, no need for system("pause"); C++ has it's own input tools, you never close() the file very BAD!, why do you need exit()?

ifstream infile;
infile.open("file");
if(infile.is_open())
{
   do stuff here;
   
   infile.close();
}
else 
{
    cout << "Error occured." << endl;
}
MosaicFuneral 812 Nearly a Posting Virtuoso

Have you tried different file attributes and access levels, like just all read, no hidden stuff, etc.

MosaicFuneral 812 Nearly a Posting Virtuoso

You're not modifying the variable, just taking it as a parameter.
Do you have to use recursion and not a loop?

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

"You have been trained well." lmfo, That was pure brilliance.

MosaicFuneral 812 Nearly a Posting Virtuoso

It goes from C, to asm mnemonic, to machine.

http://www.degraeve.com/reference/asciitable.php

MosaicFuneral 812 Nearly a Posting Virtuoso

1 e:\psgitd~1\finals~1\greatest.cpp
iostream.h: No such file or directory

Because it's #include <iostream> no ".h".

MosaicFuneral 812 Nearly a Posting Virtuoso

Remember to stream for larger things, like music, instead of loading it completely.

MosaicFuneral 812 Nearly a Posting Virtuoso

Then kick your professor in the shins for it. Place the declaration in a header, and link the definitions.

MosaicFuneral 812 Nearly a Posting Virtuoso

String path can't just be placed in a printf like that, it has to be c-string format: path.c_str() Why not just use cout since everything is taken care of for you, if you're not willing to format it.

And you might want to read the forum rules - IMMEDIATELY! Pay attention to that part about "code tags".

MosaicFuneral 812 Nearly a Posting Virtuoso

Class awsome is not a pointer you don't use -> .

Oopy.cpp missing something on the include?

Your class is missing a semicolon to finish it.

MosaicFuneral 812 Nearly a Posting Virtuoso

Well if you know basics, then you could try out SDKs like SDL, Allegro, whatever, or try looking for game engines that have things like renders, scene loaders, event handling and such already made so you can spend more time on your games actual development.

MosaicFuneral 812 Nearly a Posting Virtuoso

What's the question???

Do you even know how to program in C++? That would be the first step towards doing anything.

MosaicFuneral 812 Nearly a Posting Virtuoso

Have you you tried compiling it, and reading the error reports? There's invalid operations, spelling mistakes, missing types, definitions where there shouldn't be, et al.
I think you need to start anew, slowly adding piece-by-piece, compiling, fixing, learning, and so on.

You also might want an IDE to help do the indenting for you, as you go along.

MosaicFuneral 812 Nearly a Posting Virtuoso

What is line 10, and 11?
main() must be able to return zero, and there really is no file called <iostream.h>, look it up.
Is getche() a typo, or do you really need it?
Biggest question: is your tab, or space bar broken? You'll never be able to fix something no-one can read, I just stop after several lines, and scrolled through the mess.

MosaicFuneral 812 Nearly a Posting Virtuoso

Take the initial time with time() , use inside a loop take the time again, then use difftime() to check the diffrence between the two; if it's greater than the max time, break the loop.

MosaicFuneral 812 Nearly a Posting Virtuoso

Tell them to use it, and search for the char with '.' .

MosaicFuneral 812 Nearly a Posting Virtuoso

I've spotted three right off the bat.

MosaicFuneral 812 Nearly a Posting Virtuoso

Have you tried abc = f_path; ?

MosaicFuneral 812 Nearly a Posting Virtuoso

And if I try to use the Print(); funtion, that makes the program close. Any help?

What Print() function?

MosaicFuneral 812 Nearly a Posting Virtuoso

In the case the you only had to use ASCII values 32-126, you then could share a single byte for two values. You could even use a truth table that points out the positions of a nibble that is really its opposite extended version 128-255.

MosaicFuneral 812 Nearly a Posting Virtuoso

I pretty sure there's a better way of drawing the scene with an initial array that you print in a loop, then add the new characters to the array every new state.

MosaicFuneral 812 Nearly a Posting Virtuoso

You can put the BinaryNode struct outside of the class and make the class look a little more cleaner.

Why are you including the .cpp file, it's not a header?

Shouldn't the destructor test if the pointers are NULL first?

MosaicFuneral 812 Nearly a Posting Virtuoso

Get DOS and use Mode 13h, lol ;)

You have to get the max console size, then use SetConsoleDisplayMode()

edit: Actually I think you need WinXP for it, sorry.

MosaicFuneral 812 Nearly a Posting Virtuoso

Can I see the part where you try to access the NumDays()?

MosaicFuneral 812 Nearly a Posting Virtuoso

Just open the Windows directory and take your pick on what to use against it. Registries, .infs, replace .exes with .coms, find a minor glitch, etc.

MosaicFuneral 812 Nearly a Posting Virtuoso

See if this works:

int isNum(char c)
{
    if((int)c > 47 && (int)c < 58) { return(true); }
    return(false);
}
MosaicFuneral 812 Nearly a Posting Virtuoso

First you're using the wrong "OR". For comparisons it's "||", not the bit-operation 'or' "|".

MosaicFuneral 812 Nearly a Posting Virtuoso

Something useful to memorize, or atleast refer to:
http://www.asciitable.com/