Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>just move my code cpp code into my .h file.
You don't read very well, do you? The answer is NO NO NO.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The main reason parents don't want their minor-age kids to have sex is because sex between opposites produces babies. For a girl that will rune your life forever and ever. And guess who will get stuck with the job of raising the bastard kids? Yes, you got it -- your parents. So play it safe and keep your legs crossed so that you don't get pregnant.

Adamsappleone commented: Hello, just grabbed the first post I saw with you name on it to give you a recprocating rep. Thanks +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Bips: how did you ever get the silly idea that you can run a program written 20+ years ago for MS-DOS on a *nix box??

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I am now using Windows 7 and ansi.sys isn't on my computer. Please repost the line that works and I'll test it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 9, my_vector.h NEVER EVER include a *.cpp file in a header file. It doesn't work. You didn't say what compiler you are using but you have to compile all *.cpp files and then link the object files together to make a single executable program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how would you connect to what? How do you compile it? You have to use a compiler. Two free ones are Code::Blocks and VC++ 2008 Express.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

please send me a small c program using file handling for banking without using garphics

to obtain a mini project in c using file handling without graphics

Don't be such a lazy ass and write them yourself.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> If I compile a simple Hello World! program on a 64bit linux, will it work on a 32bit linux?

Depends on the flags you give the compiler. The default is to produce 32-bit code, but you can tell it to produce 64-bit code. Just because you are running a 64-bit operating system doesn't mean the compiler will automatically produce 64-bit code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program doesn't have to open the file, the operating system redirects the file contents to stdin of your program, just as if you are typing the data from the keyboard. Get your program working while typing the data on your keyboard, then when that works ok just run it from a command prompt as you posted.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how do i use a print statement for arrays?

something like this:

int array[10];
int i;
for(i = 0; i < 10; i++)
{
    printf("%d\n", array[i]);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 83 is wrong

void removeElement(std::vector<std::vector<std::string> > &Mat, std::string El) {
    std::vector<std::vector<std::string> >::iterator  ITx = Mat.begin();
    for(; ITx<Mat.end(); ++ITx) {
        std::vector<std::string>::iterator ITy = ITx->begin();
        for(; ITy<ITx->end(); ++ITy) {
            if(*ITy == El) {
                ITx->erase(ITy);
            }
        }
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It doesn't work on modern MS-Windows operating system. Those escept codes are intended for Win95 and MS-DOS Version 6.X and earlier which had ansi.sys device driver installed. ansi.sys has not been in use since probably Windows NT 4.0. See this Microsoft article.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

c++ does have standard libraries and a whole set of standard header files. There are at least a hundred or so of them. Look in your c++ compiler's installation directory and you will find the libraries stored in the lib directory and header files in the include directory. The directory names may vary from one compiler to another, but that's the general idea followed by most, if not all, c++ compilers on the MS-Windows operating system. The file structure is somewhat different on *nix.

You will want to invest some $$$ in a good c++ book that covers most, if not all those standard headers and libraries. See the Read Me thread at the top of this c++ forum for discussion about books.

You can find documentation for most of the using google, assuming you know the name of the file you want. For example: in the google edit box type c++ fstream and google will provide links to various sites that describe fstream class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The 2d linked lists I have worked with in the past is really nothing more than a linked list within a linked list. Something like this:

I have not done it using templates.

struct node
{
    struct node* next;
    void* data;
    struct node* head; // head of another linked list.
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

switch() is just swapping the variable addresses (which are local to switch funcction), instead of the values stored at those addresses

void switch(int* x, int* y)
{
   int hold = *x;
   *x = *y;
   *y = hold;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Forget Vista and upgrade to Windows 7. But you will have to do a clean install, not an upgrade. Backup all files you want to save before starting because Windows 7 installation will reformat the hard drive.

But if you insist you must upgrade to Vista, just put the Vista installation disk in the DVD drive, reboot the computer, and follow the prompts. You should back up all important files (games etc) in case something goes wrong.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This has to be one of the dumbest polls I have seen in my four years here at DaniWeb.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can do this

class test 
{
public:
    std::string write();
};
 
std::string test::write()
{
	std::string name = "HELLO";
	return name;
}


int main ()
{
	  test A;
	  cout << A.write() << endl;
	  return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to clearly define terms, such as "sentence", "atomic sentence", "conjunction", etc. Don't just assume we know what those terms mean.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I just installed 64-bit Windows 7 Home Prem the other day. I wanted to upgrade from Vista Home Prem, but the upgrade failed for some reason. So I just did a clean install. I've tried both Ubuntu and Fedora 11, but neither will let me play videos on my DVD and had lots of problems with sound. I had none of those problems with Vista/Windows 7.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

right click the IE icon in the task bar, then from the popup menu select "Internet Explorer", near the bottom of the list.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I finally found the solution -- I just had to change the ownership from SYSTEM to myself (Administrator).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>quite sure I look the new task bar so much though
The task bar doesn't look much different than Vista's.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>However the array dosent show
What does that mean? And please use code tags.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>if (the number is a character) //don't quit get that

You will need to get the number in a char variable, not an int variable. Then the above line will make sense because you need if( !isdigit(character)) maybe this will make more sense

#include <iostream>
using namespace std;

int foo()
{
	char c;
	cout << "Enter a character\n";
	cin.get(c);
	if( !isdigit(c) )
		throw "Not a digit";
	return c;

}

int main()
{
	char c = 0;
	try
	{
		c = foo();
	}
	catch(const char* msg)
	{
		cout << msg << "\n";
	}
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The subject of this thread is "function to release cpu". Sleep, or a variant, does that. And the cpu can not be release for less than 1 millisecond, and in *nix there is no guarentee that it will be released that length of time.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When using random numbers there is no guarentee you will get 5 heads and 5 tails.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Please re-read my previous post -- I changed it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> while( k != isalpha(ch) || k != MAX_DIGITS)

The problem is that line. Why test for k != isalpha(ch) ? The loop counter has nothing to do with the value of ch. And if you type fewer than MAX_DIGITS then the next cin.get() will wait for you to enter anoter character.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It doesn't work for you because when you open the file for output ofstream truncates it to zero length, erasing all its contents. Comment out ofstream and its open statement then your program will work (after you add the data back into the file again).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you only enter one argument then argv[2] is invalid. The program will only have argv[0] and argv[1].

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

blud: you need to invest in a blue-ray read/writer so that you can put all those movies on dvd instead of keeping them on your hd.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just use a linked list of stacks. Are you using a structure to represent the stacks?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

MS-Windows: Sleep(int milliseconds)

*nix: sleep(int seconds) There is another one too that takes milliseconds but I don't recall its name.

In MS-Windows you can call WiatForMultipleObjects() to put the main thread to sleep until all worker threads have finished. You don't need that loop at all.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Better still, uninstall that IDE/compiler and use Code::Blocks with current version of MinGW compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I installed Windows 7 this morning, then installed VC++ 2008 Express again. Now I want to install a dependency walker in its installation folder. But suprise suprise, the folder is marked read-only. Using Windows Explorer to change permissions does nothing. Yes, my account is set up as Administrator (already checked that). I recall a similar problem years ago with XP but don't recall how to fix the problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

which are the runtime file that I have to check

You told Tom you already had the runtime files. In any event, there is a folder named "redist" in your vc++ installation directory. At least I thought those are the dlls you are talking about. There may be others, such as .NET framework. Use this depdency walker to find out what all your program needs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why not just check if the runtime files are in the c:\windows directory?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My bet is that the window is closing before you have a chance to see the output. The reason is that when you enter numeric data the program will leave the Enter key '\n' in the keyboard buffer, and when cin.get() is called it just retrieves it. When you need to do is flush that out of the buffer. Add cin.ignore(); after cin >> width; [edit] What ^^^ Tom said :) [/edit]

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just installed 64-bit Windows 7 Home Premium. So far so good. I did a fresh install, reformatted the hard drive, and installed fresh.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

AFAIK there are no other FREE compilers for *nix.

>>in labs we use the CC compiler
I think that CC is just a generic name for *nix compilers. The real compiler could be almost anything.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what compiler are you trying to install. I don't have my crystal ball with me so you will just have to post it. If you are trying to install Turbo C on Vista then you can forget it because that compiler will not install on Vista. Get a modern compiler such as Code::Blocks or VC++ 2008 Express, both are free.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And of course it will depend on what operating system you are using.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Use a friend function to overload the >> operator

class Time
{
private:
    int hour, minute, second;
public:
    Time() {hour = mijnute = second = 0;}
    friend istream& operator >> (istream& in, Time& t);
};

// Put this in the *.cpp file, not the *.h file
istream& operator >> (istream& in, Time& t)
{
           cout << "Enter time";
           cin >> t.hour >> t.minute >> t.second;
           return in;
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

more than likely attempting to write beyond the bounds of an array. Locating the error in large programs can be difficult. One method I have used is to comment out large blocks of code until the problem goes away.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How do you know which of the two methods are called? Neither actually do anything (just do-nothing methods)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i can't understand what these parameters means

There are only two of them :icon_eek: Read this.

The execv and execvp functions provide an array of pointers to null-terminated strings that represent the argument list available to the new program. The first argument, by convention, should point to the file name associated with the file being executed. The array of pointers must be terminated by a NULL pointer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So what's the big problem? You might have to change the structure of the whole problem, such as make a menu such as

1. Add new string to file
2. Display file contents
3. Quite

Then create a switch statement that processes the requested action.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It depends on the program you write. You might read through this rather old thread to see if it gives you any ideas.