Freaky_Chris 299 Master Poster

Indeed, however i have a feeling it may be a similar problem to this....

if (v1[j]==v1[i])
{
v1[j]=="";	
}

What exactly does this do?

Freaky_Chris 299 Master Poster

When you install Dev-C++, at some point you need to specify a directory where it gets installed. Whenever you (or a batch script you're executing) refers to D:\gcc, you need to change it so it refers to the directory you installed dev-C++.

If you did install into d:\gcc, then presumably you or someone else have removed that directory. So you need to reinstall dev-c++.

^^ grumpier has got the other solution there for you.

Re-install Dev-Cpp

Freaky_Chris 299 Master Poster

Right first of all you should try and find the gcc folder, my guess is that its probably in Dev's default install location

C:\Dev-Cpp\Bin

Once you have found it, in dev do the following

Tools -> Compiler Options -> Directories -> Binaries -> Change D:\ to where ever the file is (more than likely where i stated above)

Hope this help

Freaky_Chris 299 Master Poster

Actually check yourself, go to D:\gcc and check that you can find cc1, my guess is you wont.

Then it depends which compiler you are using as to how you change it...so if needed please tell us

Chris

Freaky_Chris 299 Master Poster

Check that gcc is installed in that location... if it isnt then change your compiler to look for it where ever it is installed.

Chris

Freaky_Chris 299 Master Poster

I still have a problem... everytime i close cmd i always need to type

set PATH=%PATH;bin location

before i can use the g++ command.

Is there a way that I can directly use the g++ command after launching cmd?

Yes follow these steps sorry if you already know, i'm going to assume your on XP


1) Right click my computer
2) Select Properties
3) Advanced Tab
5) Environment Variables
6) Under system variables find "Path"
7) Click edit and append with a semicolon separator the new location

And your done, hope that helps

Chris

Freaky_Chris 299 Master Poster

Hmm...show us some work? Lets see how far you get.

Let us know where you get stuck.

Read up on Lexical Analyzers...http://en.wikipedia.org/wiki/Lexical_analysis

Freaky_Chris 299 Master Poster

So you change the default program from notepad or whatever to your program, ofcourse this is all done in the registry. Which if you have a look through you will find that the extention .txt will trigger myapp.exe you can append a paramater on the end of that which represents the file name.

Chris

Freaky_Chris 299 Master Poster

To run your program for a specific amout of time, you are correct you will need threading.

Once you understand threading, you may want to have a look at the ctime header

http://www.cplusplus.com/reference/clibrary/ctime/

This will provide a method of checking how long the program has been running, you would set this check up in a different thread to everything else.

Chris

Freaky_Chris 299 Master Poster

No he is wanting to print all the possible outcomes when a coin is flipped X times

Freaky_Chris 299 Master Poster

What?? I know a lot of people who will write code for money (myself included). I believe it's fairly standard practice; even a respectable career option.

I don't mean i tlike that, i know many people indeed that would / do write code as a career. I'm saying people will not write code even if they are being paid for someone's assignment.
There's a big difference my apologises if it didn't come across this way.

Chris

Freaky_Chris 299 Master Poster

Is it part of the requirements to use recursive function? This program can be done easily without recursive function. Just use a loop is enough.

Also, check out rand() function to generate random number, and srand() for seeding the random generator.

Why would one need to generate a random number to display all the permutations?

Freaky_Chris 299 Master Poster

@plum
Aslong as he doesn't mind his program being 100% accurate the latter is good idea.

A bit more information about the latter for you,

time() comes with the including ctime,
i'd suggest having a read about the ctime header and all of its functions

http://www.cplusplus.com/reference/clibrary/ctime/

Chris

Freaky_Chris 299 Master Poster

If you want to use getline() then strtok() would work perfectly for you. To split the line of text into indervidual words

Chris

Freaky_Chris 299 Master Poster

I trust you have installed all of the required libraries etc

And set up all global varialbles.

once all is set up i believe this should work

g++.exe "C:\file.cpp" -o "C:\File.cpp" -I"Include directory"  -I"another include directory and so on"  -L"libraries"

and to run it

start C:\file.exe
Freaky_Chris 299 Master Poster

Ye this is true no respectable forums will do your assignment for you. So you have 2 choice's pay someone...again good luck cause most ppl still won't do this OR DO IT YOURSELF(at least have a good go)

YAY im joining in with the free posts, i love it!

Freaky_Chris 299 Master Poster

Actually it can turn into a game, there a ae many different arrangements of cells in the game of life, which have different names, sch as glider -- these will move in 1 direction continually untill another live cell interupts this.

Many appterns can be created to do many differents things, there are very large patterns that have been designed to create different patterns continually.

Also from what i know the Game of Life can be researched greatly by algorithms and alot of time is spent investigating these algotihms. In actual fact the fastest way to make the largest number of cells live was found by a computer algorithm

Chris

Freaky_Chris 299 Master Poster

Ofcourse he would have to create a main function containing all of his program.

Depending on how py2exe works it may be needed for the program to initialize correctly

Freaky_Chris 299 Master Poster

Hey, enjoy your stay. This may help clear anything up that your unsure about if you wan't already use it, you should!

http://java.sun.com/docs/books/tutorial/

Chris

Freaky_Chris 299 Master Poster

Try using this

if __name__ == '__main__':
     main()

That may help. I'm guessing you are familiar with it, and therefor i don't need to explain

Chris

Freaky_Chris 299 Master Poster

As in 2 .cpp files and a .h, If so then perhaps you could show the error log.

Freaky_Chris 299 Master Poster

hehe thanks, was eating my dinner a bit distracted :P

Freaky_Chris 299 Master Poster

It has already been pointed out to you. if (genArray[i] == "ACG") This will not work, your are comparing a char* with a string. As it has already been pointed out.

I'll just restate the fact you need to check character by character

if (genArray[i] == "A"){
  if (genArray[i+1] == "C"){
    if (genArray[i+2] == "G"){
       std::cout << "Found 1!"
    }
  }
}

very simple way

Freaky_Chris 299 Master Poster

Realtek may be able to help you out. They have drivers compatiable with ALOT of sound cards

Freaky_Chris 299 Master Poster

Check you don't have any extra programs trying to launch on boot that you do not want and may be causing this. Just check..

Start->Run->msconfig

Freaky_Chris 299 Master Poster

Scan your pc using any half decent spyware removal tool / ad-ware removal tool. If it cannot fix it, then it will more than likely tell you which file it is embedded in so just find it and delete it yourself. BTW post in the correct forum please.

Freaky_Chris 299 Master Poster

My clue for you

Our Software Development forum category encompasses topics related to application programming and software design. When posting programming code, encase it in [code], [code=syntax], where 'syntax' is any language found within our Code Snippets section, or [icode], for inline code, bbcode tags. Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.
Our C++ forum is the place for Q&A-style discussions related to this popular language. Note we have a separate C forum for non-OOP straight C. Please direct C++ questions directly related to game development to our Game Development forum.

Freaky_Chris 299 Master Poster

Doing it a long hard way here is a brief explanation.

If you have a integer input then you first need to split it into indervidual numbers i.e

11010111

would become

1 1 0 1 0 1 1 1

(spaces show a split into an array or whatever)

Then you need to multiply each one by 2^x where x increase by one(starting at 0), however this must be done in reverse order. then you must add them together to give you your decimal number

1x2^7 + 1x2^6 + 0x2^5 + 1x2^4 + 0x2^3 + 1x2^2 + 1x2^1 + 1x2^0
----------------------------------------

As for splitting an integer there are multiple ways, some involve convering it to strings. However going on the idea of normal and modulus division. This is how it would be done

ie the number 11010111
x = (number of chars)

(11010111 % x) / x-1

that would get you the ver far right 1

then next would be
(11010111 % x-1) / x-2
etc

hope this helps

Freaky_Chris 299 Master Poster

Yer there is another option that would require someone to right a not to complex script for you. That could check for all duplicate files & folders and move them to a specified location. It shouldn't be to complex either.

Plus you can garuntee what will happen that way,

Chris

Freaky_Chris 299 Master Poster

Get us started with some code and we will love to help you,

Freaky_Chris 299 Master Poster

No problem if there is anything you don't understand just ask

Freaky_Chris 299 Master Poster
#include <iostream>

using namespace std;

const int Months = 12;
const int Years = 3;

int main(){
 
 const char * months[Months]={"Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"};
 
 int temp = 0;
 int sales[Years][Months];
 
 cout << "Enter the sales data for each month during 2005-2007.\n";
 
 for (int i = 0; i < 12; i++){
     cout << months[i] << ":\t";
     for (int j = 0; j < Years; j++){   
         cin >> sales[j][i];
         cin.ignore();
     }
 }
 return 0;
}

That help at all, i've just cleaned it up a bit seems to work ok...

Freaky_Chris 299 Master Poster

if you have downloaded and install all the latest drivers for your correct model number it should work fine...

Freaky_Chris 299 Master Poster

This sound to me like it is your Anti Virus, anti virsus software has been known to corrupt and drop alot of incoming packets. After disabling / uninstalling your anti virus, you may need to restore one specific file on your PC this can be done but i cannot remember the comand line argument to do this, trying calling up your anti virus provider and asking them about it.

Chris

Freaky_Chris 299 Master Poster

Have you tried booting in safe mode, that might allow yuo to login in correctly then delete any files that may be cause the problem

Freaky_Chris 299 Master Poster

Make sure you have at least 2GB of ram.3 GB or more makes it run smooth

this is True, i am running a 3gb RAM vista box, bost of the time at least 40-50% of my RAM is in use just to allow vista to run. So anything less than 2gb will deffinatly cause problems for you.

Chris

Freaky_Chris 299 Master Poster

I would question Zone Alarm, it is very good i have to agree. However it can get very tempramental and be a major cause of blue screens, Comodo is a very good firewall as long as you have the paitents to fully configure it.

Every incoming connection of any kinda requires your approval, so full configuration can take some time but can prove very helpful.

Chris

Freaky_Chris 299 Master Poster

Do you have this problem whilst your are completely disconected from the internet?

Sometimes download trojans and things can cause this, if you find that being disconnected from your internet solves this then you may be ok.

The other problem may be your graphics card, if you have a faulty grapghics card you can get this very problem. I have experienced it my self before. You have to methods of solving, download and re-install the driver hoping its the driver and not the card OR buy a new card / get it replaced.

Hope this helps,
Chris

Freaky_Chris 299 Master Poster

You will need to install all the drivers listed on the manufacturers site

Freaky_Chris 299 Master Poster

You have to create a date object from the text box text before you can compare it to another date object

I believe not a VB.NET programmer :/

Freaky_Chris 299 Master Poster

You are still trying to print out the value of a before you have retrieved its value from the user via scanf()

Freaky_Chris 299 Master Poster

A quick google turn up what look to be a nice page

Google is your friend, also if you don't know java to well i would recommend getting to know it a bit better first

Chris

Freaky_Chris 299 Master Poster

The reason your code got shifted to the left was because you didn't use code tags, another thing pointed out in posting guide lines

Freaky_Chris 299 Master Poster

This depends on the type of system you're on. \r\n is Windows, \n is Linux, and I believe that \r is Mac (although I've never used one so I don't really know).

Yer thats the correct line endings for each different OS, and if you intend to have it portable make sure you do some kind of check as to what os is running and append the correct line endings otherwise you will have some problems

Freaky_Chris 299 Master Poster

Well you could use a simple array to count how many times each number occurs.

int nums[= = {0,0,0,0,0,0};
nums[roll()-1] += 1;

You get the idea, thats assuming roll() returns a number between 1&6

Freaky_Chris 299 Master Poster

I just like to compare thats all, plus i think its a good learning tool xD

Freaky_Chris 299 Master Poster

You guys really should have a good read up on Threading and follow the example given it will work fine for you

Freaky_Chris 299 Master Poster

have a read about the atoi() function

Freaky_Chris 299 Master Poster
#include <iostream>
#include <sstream>
#include <string>
using namespace std;

void print_int(int number){
	stringstream tmp_stream;
	tmp_stream << number;
	string str_num(tmp_stream.str());
	int sum = 0;
	for (size_t i = 0; i < str_num.size(); ++i){
		cout << str_num[i] << ' ';
		sum+=str_num[i]-'0';
	}
	cout << sum;
}

int main(int argc, char **argv) {
	int number;
	cin >> number;
	print_int(number);
	return 0;
}

Interesting to see the different solution..heres the one i used, note this is just function not main program to call it

#include <iostream>
#include <cmath>
#include <limits.h>
#include "DigitSeparator.h"

void DigitSeparator::Separator( long int x ){
     int z;
     int q = 1;
     int sum = 0;
     
     if(x <= ULONG_MAX){
         while(1){
             if(x < pow(10.0, q++)){
                 z = q-1;
                 break;
                 }
             }            
         while (z != 0) sum += (int)((x%(int)(pow(10.0, z)+0.5))/pow(10.0, --z));
         std::cout << sum;
     }
     std::cin.clear();
     std::cout << "\n\n";
}
Freaky_Chris 299 Master Poster