MosaicFuneral 812 Nearly a Posting Virtuoso

2. foo(int count, ...); stdarg
3. API

MosaicFuneral 812 Nearly a Posting Virtuoso

firstPerson, more important is Code Tags.

To use command prompt, go to Start->Programs->Accessories, then use cd to navigate to the file and then type the name of the program.

MosaicFuneral 812 Nearly a Posting Virtuoso

Why are you making this so complex???

vector<char> container;
    
    cout << "i = 0; i++ till 255" << endl;
    
    for(int i = 0; i < 256; i++)
    {
        container.push_back(i);
        cout << '.';
    }
    
    cout << endl << "Printing: ";
    
    for(int i = 0; i < container.size(); i++)
    {
        cout << bitset<numeric_limits<char>::digits>(container[i]) << endl;
    }
MosaicFuneral 812 Nearly a Posting Virtuoso

Look up "C++ bit operations"

Inline assembler is platform and compiler specific.
http://www.penguin.cz/~literakl/intel/intel.html
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html

MosaicFuneral 812 Nearly a Posting Virtuoso

You mean varible++; , or variable += 1; ?
Perhaps you could go to the extreme of doing it with bit operators(I have for fun), or using the inline assembler to do it. So many options, but which is right for you?

MosaicFuneral 812 Nearly a Posting Virtuoso

Can I see some code?

MosaicFuneral 812 Nearly a Posting Virtuoso

Quick nickpicks: I don't see a destructor, and keep rules[] private. Normally variable names are lowercase.

Why are you assigning it zero?

Rule *rules;
rules = new Rule [200];
delete [] rules;
MosaicFuneral 812 Nearly a Posting Virtuoso

This is most of the general containers in C++: http://www.cplusplus.com/reference/stl/

Stack is sort of useless, for this.

MosaicFuneral 812 Nearly a Posting Virtuoso

You should split up all the tasks into separate functions. All of it should be part of class.

The file handling would probably look like this. Unless you're concerned about massive files..

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

         file.close();
    }

You now have the contents.
Time to just get where a tag ends and begins, continue to alter the attributes of the inner-most data based on these tags.

MosaicFuneral 812 Nearly a Posting Virtuoso

You could join Source Forge.

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

^-- *points to my avatar* Been watching to much of that show?

Programming would just be a layer of control over other devices. It's just another tool in the process there - like a screwdriver.
Isn't the internet close enough of a time machine for you?

MosaicFuneral 812 Nearly a Posting Virtuoso

It can return all sorts of things. So does Google.

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

I thought it was a he? 0.o

That was cool. Never as good as Yehudi Menuhin, though.

MosaicFuneral 812 Nearly a Posting Virtuoso

Substring parts out to istringstream to get the values, start adding the seconds up, get difference from Jan 1, 1970 UTC

MosaicFuneral 812 Nearly a Posting Virtuoso

Should I trust this external site?

MosaicFuneral 812 Nearly a Posting Virtuoso

Mobile what??? Particularly what OS does it have?
There's a lot of remote admin programs out there, just base it on those.

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

Or just simply:

void get_lines(vector<string> &lines, const char *name)
{
    ifstream file(name);
    string str;

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

        file.close();
    }
    else
    {
        set some error flag;
    }
}

Make it part of some class that handles the config file, then handle the lines.

You can't close() a file if it doesn't exist, and you never closed() it before you returned in if(found) .
It's a bit messy.

MosaicFuneral 812 Nearly a Posting Virtuoso

Depends on how realistic you'd want to go, and how abstract your design is, for the physics engine.

MosaicFuneral 812 Nearly a Posting Virtuoso

Like MyStringClass object = const char *; ?
You'd just simply overload it.

MosaicFuneral 812 Nearly a Posting Virtuoso

You do not declare, or define functions in other functions.
Macros tend to go outside publicly.
Are you actually modifying text[] in convertToUpper()?
You loop and call a function, but only call printf() once, because you're missing something.
If the file didn't open, do you have to frantically escape, and not just pass over code with an if-else condition?

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

Have you ran through the code till this occurred?
And actual code is nice, too.

MosaicFuneral 812 Nearly a Posting Virtuoso

Did you declare unroll?
Do you have the error log?
Did you even bother to read the forum rules; that you have violated?

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

It's a semicolon, not a comma.

You should also use a loop, not leaving it unrolled like that, especially
if you decide to expand the array size latter.

MosaicFuneral 812 Nearly a Posting Virtuoso

Have you even tracked the code till it freezed, and then evaluated it?

MosaicFuneral 812 Nearly a Posting Virtuoso

Just don't use macros for loops.

MosaicFuneral 812 Nearly a Posting Virtuoso

Pyramid Apricot Ale, bit of left over ham and bread. Really good.

MosaicFuneral 812 Nearly a Posting Virtuoso

Scan keyboard state, read keys till Return pressed.

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

Site rules, "CODE TAGS!"

The usual structure I suggest often, to avoid the whole emergency bail out thing.

file open
if(file.is_open())
{
  do stuff here;

  file.close();
}
else
{
   cout << "Error!";
}

You probably should place those loops in a function too.
Where is i declared?

You need to format it and place it in code tags, I got lost, and was sure I saw something funky with the brackets after the second for loop.

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

Rashakil did suggest GNU MP in one of your other posts.
Your own small basic version wouldn't be hard either.

MosaicFuneral 812 Nearly a Posting Virtuoso

Well it'll be three years old soon.

thanx 4 ur opinion. i ll remember it next tym. well i m new to this . joined sterday only.
i jus ve started learning abt C. thought culd help. sorry anyway
a small hint ta u, next tym if u culd b a bit more polite.

English is a rule, too.

Salem commented: Agrees and agrees :) +26
MosaicFuneral 812 Nearly a Posting Virtuoso

Can't you use a loop instead?

You could create a class that grows and manages the value split over vectors, overloads the general math operators you'd need, then stores the values into a file.

MosaicFuneral 812 Nearly a Posting Virtuoso

If you're desperate for small code, and you're in Windows there's MASM; but that's obviously a very different language from C++.

There's also the -s option and -Os, in GCC.
The manual:
http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/
And a quick primer:
http://tfc.duke.free.fr/coding/gcc-en.html

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

Open a file, read everything from it. Write everything you read to new file.

MosaicFuneral 812 Nearly a Posting Virtuoso

For just basic ASCII, XOR 32 works.

MosaicFuneral 812 Nearly a Posting Virtuoso

Voids don't return, and a well design program IMO should never use exit(). Why would your functions need all these pointers?

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

I'm surprised the filter didn't list this as profanity, when it doesn't even allow the mildest things....