DeanMSands3 69 Junior Poster

Either use a return value or a pass-by-reference parameter.

//Using a return value
int getLength(char *myString){
    int length;
    for(length=0;myString[length]!=0;length++){}
    return length;
}
//Passing by reference
void getLength(char *myString, int &length){ //notice the '&' before length
    for(length=0;myString[length]!=0;length++){}
}
DeanMSands3 69 Junior Poster

I was going to roll my own, but this works just fine.
http://www.fredosaurus.com/notes-cpp/algorithms/string2int-ans.html

Adapt it to eliminate the bools if you need to, but the code should work just fine.

DeanMSands3 69 Junior Poster

Are you running Windows, Mac, or Linux?

If Windows, are you using Visual Studio, NetBeans, Eclipse, Dev-C++ or Turbo C++?

DeanMSands3 69 Junior Poster

AllocConsole is your friend.
http://lmgtfy.com/?q=allocconsole

DeanMSands3 69 Junior Poster

There are two loops in the bubble sort. With one loop, essentially, you're only doing one pass, sorting the highest value to the top, but neglecting the others.
This may prove useful: http://www.codecodex.com/wiki/Bubble_sort


Also, you may want to change that i==5 to i==4. When i equals 5, you'll be starting your second line, but you're putting in the line break after you've printed arr[5]. Since you 10-element array goes from 0...9, you'll be printing something like
0 1 2 3 4 5
6 7 8 9

Hope this was helpful.

Happy coding!

DeanMSands3 69 Junior Poster

Compiled in MinGW under Eclipse without changing any linker settings. Ran fine for me.
What compiler are you using? (And where did you get it?)

DeanMSands3 69 Junior Poster

The disagreement is minimal. Having done low-level code, I often think in low-level. But the user will likely never notice. Ever.
As deceptikon said:

There's not going to be a significant enough difference for you to worry about it.

One thing I neglected and he's right about is that, yes, using const chars are easier to debug than macros.

DeanMSands3 69 Junior Poster

Well, you can do a private Wi-Fi network secured with Pringles cans (you think I'm joking). Or you can set up laser transceivers - effectively fiber-optics without the cable. Unfortunately, ANYTHING can upset the signal. Anything. Like squirrels. Rain. Kites. Obese persons on ladders. Anything.

DeanMSands3 69 Junior Poster

Program 1:

  1. Prompt the user for the file size in KB of the first file.
  2. Scan for keyboard input and store in a variable.
  3. Multiply by that by the number of bytes in a KB. Multiply again by number of bits in a byte.
  4. Prompt the user for the time in seconds needed to download the first file.
  5. Scan for keyboard input and store in a variable.
  6. Multiply by that by the number of bytes in a KB. Multiply again by number of bits in a byte.
  7. Prompt the user for the file size in KB of the second file.
  8. Scan for keyboard input and store in a variable.
  9. Prompt the user for the time in seconds needed to download the first file.
  10. Scan for keyboard input and store in a variable.
  11. Divide the file size of the first number in bits by the download time and store in a new variable.
  12. Divide the file size of the second number in bits by the download time and store in a new variable.
  13. Average the two together and store in a new variable.
  14. Print an output displaying the average bits per second of the internet connection.

Program 2:

  1. Prompt the user for the total number of pages used in a day.
  2. Scan keyboard for input and store in a variable.
  3. Multiply that by the number of days in a week.
  4. Prompt the user for additional weekly usage.
  5. Scan keyboard for input and store in another variable.
  6. Add …
DeanMSands3 69 Junior Poster

#1 and #2 are, at run time, essentially the same except that enums (if I remember correctly are integers instead of characters). Also, they will be doing stores and comparisons with literal values (i.e. x=1,y>2, z<3) instead of referenced numbers.

#3 will use more memory at run-time since it allocates the const chars then references them (i.e. comparing by reference).
At the CPU level, this makes a world of difference. Since the CPU has to access the memory to get the number you're referencing, it will take more time to process it as opposed to you simply handing it the number.

DeanMSands3 69 Junior Poster

Two possibilities.
A. roll=int(num*11)+2; //Just reduce the 12 to 11 and add 2 instead of 1.
B. rewrite it to roll a single die, save the value, then roll again.

DeanMSands3 69 Junior Poster

Yeah... that's happened to me. My church was using a free web host and wanted to create a mailer. Much to our surprise....
I've since moved to paid hosting and that's no-longer a problem. But for you, that's not really an option I guess. Sorry to hear it.

DeanMSands3 69 Junior Poster

OK, look at your main function:

int main(){
	int option =0;
	bool exit = false;
	while(!exit) {
		displayMenu(option);

		switch(option) {
		case 1:
			doTaskA();
			continue;
		case 2:
			doTaskB();
			continue;
		case 3:
			doTaskC();
			continue;
		case 4:
			howMany();
			exit = true;
			break;
		default:
			printf("Incorrect selection. Try again.\n");
			continue;
		}
	}

	return 0;
}

I'm not sure why you're using continue instead of break. The break would only exit out of the switch block and not the while loop.
So... after each of the tasks, you should be incrementing a counter. However, that counter is located here:

void howMany(){

	static int count = 0;
	count++;

	printf("This program has run" " %d " "times\n\n\n",count);

	system("pause");

}

HowMany is only getting called at the end of the program. Therein lies your problem.
My recommendation: yank the count variable declaration from howMany and make it global. Then, after each task is run, put count++; after each of their respective blocks (except number 4 and the default) in the switch.

DeanMSands3 69 Junior Poster

I want to make a hoe joke so very badly...

So... nobody brought this up, but libPThread is PRIMARILY a Linux library being "POSIX Threads."
There is a Windows implementation available and can be installed as part of MinGW using it's Get command (i.e. mingw-get, the command line apt-get substitute).

References:
http://en.wikipedia.org/wiki/POSIX_Threads
http://sourceware.org/pthreads-win32/
http://mingw.org

DeanMSands3 69 Junior Poster

Is your blat program in the system path or where your program can find it?

DeanMSands3 69 Junior Poster

Very nice. However, somewhere along the line, in the zoom functions, times became an asterisk and center became a cent.

DeanMSands3 69 Junior Poster

Let's start with the basic psuedo code:

X=2
WHILE X IS LESS THAN MY_NUMBER
IF MY_NUMBER MODULO X IS 0
THEN RETURN FALSE
ELSE INCREMENT X BY 1
LOOP
RETURN TRUE

Now, that's fantastic and all, but it's very inefficient.
After 2, there aren't anymore even primes. Let's make our code look like this:

IF MY_NUMBER MODULO 2 EQUALS 0
THEN RETURN FALSE
X=3
WHILE X IS LESS THAN MY_NUMBER
IF MY_NUMBER MODULO X IS 0
THEN RETURN FALSE
ELSE INCREMENT X BY 2
LOOP
RETURN TRUE

Since a prime number is any number where N=/=X*Y where X and Y are positive integers other than 1, it stands reason that there's going to be some overlap.
Let's have a look at the factors of 12, not counting 1.

12/2=6
12/3=4
12/4=3
12/6=2

Doesn't that look funny?
Why are we checking 4 and 6 when we've already check 3 and 2. Where to draw the line? At the square root of course. However, a square root operation is expensive when added to the loop. But a simple multiply isn't so bad.

IF MY_NUMBER MODULO 2 EQUALS 0
THEN RETURN FALSE
X=3
WHILE X*X IS LESS THAN MY_NUMBER
IF MY_NUMBER MODULO X IS 0
THEN RETURN FALSE
ELSE INCREMENT X BY 2
LOOP
RETURN TRUE

Now, if you really want to have some fun and you're going to be checking a lot of numbers you do it a little different.
Instead of incrementing X …

DeanMSands3 69 Junior Poster

Well, to start, setup a space for your string for 11 bytes(trailing zero) and put that in your data section.
Also, put your string prompts into the .data section. (i.e. "Enter 10 character string: ")
Then, in your main program, you print the prompting string (you know how to use syscall, right?)
Point the $A0 at the input string buffer.
Use the syscall for reading an input string.

Repeat this block for characters 2, 4, 6
Print out the first output text ("The 3rd character: ")
Load an immediate 2 (being the 3rd number) into a temporary register like $t0.
Use a load byte for $a0 from your input string offset by that register.
Use the print byte syscall.
Repeat (or just copy/paste)

And syscall to exit.
Happy coding!

EDIT: For sanity's sake, start your "The 3rd character: " with New Lines (i.e. "backslash n"). That way, when you print you character, and then the next string, it won't be jammed together.

DeanMSands3 69 Junior Poster

Hm... just for sanity's sake, make this change:

org	0x000
goto	Start

org	0x005
Table_	addwf	PCL,f
dt	0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f

I've got a little background in PICs. I'll look over this more when I get the chance.

DeanMSands3 69 Junior Poster

Let me explain the system("...") function.
system("x 1 2 3"); calls a program "x" and passes it the parameters 1, 2, and 3.
So instead of dropping system() entirely, you'd be doing something like system("blat blah.txt -to somebody@somewhere.com");

Also note that blat requires a text file to email, otherwise it might not work.
Also, there's a really good chance your email server will mark your file as SPAM. Make sure to check your spam folders regularly. But who knows?

DeanMSands3 69 Junior Poster

string is a C++ type. You'll want to convert your code to use C++ instead. string.h is a C header file and doesn't provide that.
If you don't want to use C++, you should use character arrays. And instead of acountry[j]=arr; you would use strcpy(&acountry[j].code,&arr);

DeanMSands3 69 Junior Poster

Well, for starters, you want to put your code inside the [ CODE ] blocks. It preserves the formatting.
Looking at your code isn't as much fun without indentation.

And... and... you have used GOTO. And you have sinned.

Just kidding. (But you may want to look into ways around that.)

I would break the code down into functions to make it more modular and also easier (MUCH EASIER) to read.

Before we go any farther, I will give you an out. Everything you want to do CAN be done using cout and cin and the dec, oct, & hex modifiers. And also scanf with
the x modifier will work.

Now, to get you started, I want you to look at this:

a[i]=a[i]-48;

That works for numbers. And only numbers. If you want to add hexadecimal, you need to look beyond numbers.
Try this.

if(a[i]>='0'&&a[i]<='9'){	//Only use this conversion for numbers
			   a[i]=a[i]-48;
		   }else if(a[i]>='A'&&a[i]<='F'){	//Only use for upper case letters
			   a[i]=a[i]-64;
		   }else if(a[i]>='a'&&a[i]<='f'){	//Only use for upper case letters
			   a[i]=a[i]-96;
		   }

More to follow.

DeanMSands3 69 Junior Poster

Why did I say that? The way you worded your question gave me a clue you might be a little green. A semi-seasoned coder would have asked for help in socket programming. They might have even mentioned watching "sendmail" programs inside a WireShark session.
You didn't word yours that way. Instead, you asked for a finished product without realizing it.
Now to business. Your proposed method system("mailx...") calls an outside program (mailx) to send the email. Admittedly, that's a simpler solution I hadn't considered.
Now, mailx is a Unix/Linux program. You can get a Windows version, but it will insist on some Unix-isms you may not be happy with.
I recommend having a look at blat or any other open source email program designed for Windows.
Look over the command-line usage and adjust your system("..."); command accordingly.

Happy coding!

DeanMSands3 69 Junior Poster

What you want to do is likely above your present ability. (For now.)
I'm telling you this kindly.
However, you have asked a question, and I will answer it.
(Who knows, this might be the start of a wonderful new world of socket programming for you.)

First, since you are using Windows, you will want to familiarize yourself with Winsock.
Google windows socket tutorials
You will find a nice tutorial for it here:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9818&lngWId=3
And a handy reference here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738545(v=vs.85).aspx

Code Project is also a fantastic place for finding code examples, but you'll need to register to download.

Since you are using the MinGW compiler (part of Dev-C++), you will need to add -lwsock32 and -lws2_32 in your libraries.

Once you're comfortable with writing socket code, I suggest you have a look at this:
http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
Have a look at the example exchange in the article. It'll help.

Happy coding!

DeanMSands3 69 Junior Poster

WaltP and Deceptikon are right. And I can tell they're ready to lose their patience. It's a simple fix, but to a new coder, it may not be obvious.

See this line of code?

printf( "Enter gallon used (-1 to end): " );
  scanf( "%d", &gallon);

This is the only time you change the gallon variable. It is used elsewhere, but not changed.
The while loop depends on the gallon variable. If the while loop is processing and the gallon variable is not changing, the while loop will loop forever. So the question becomes "do you really want that block of code where it's at or would it be more useful somewhere else?"

DeanMSands3 69 Junior Poster

Without generating the data myself I'm kind of limited in what I can do to help.
However, chi_squ_end[10000000] bugs me. A lot. And being a double type, on a 32-bit system, that thing's 80 Million bytes huge.
May I humbly suggest moving outside and before the main block. This takes it outside the "stack" and places it on the heap. Honestly, I have no idea how well it'll work.
But after doing work on small memory devices and discovering the "joys" of sprintf in confined spaces, I've learned to become deathly wary of putting big items on the stack.

What does this do and why is it doing it that way?

for(w=0.002;w<0.001; w=w+0.005)
DeanMSands3 69 Junior Poster

Multi-threaded/process programs for starters.
Mutexes, Semaphores, all the yummy goodness.
Then there's windows, messages, callbacks.
You know. The stuff they don't teach you in college until MAYBE the senior year. Even then, my Operating Systems class never touched GUIs let alone straight from the OS API.
This is the good stuff.

And it'll carry over when you branch into other OSes. The function calls will be a little different, but the idea is mostly the same.
Except for Unix's fork(). What the hell, Windows?

DeanMSands3 69 Junior Poster

These is not the article you are looking for. (Especially Method 3.)
http://www.codeguru.com/cpp/i-n/network/networkinformation/article.php/c5451

DeanMSands3 69 Junior Poster

That's some-funny looking code in the first program. It looks like one programmer wrote a "test port" program and a second one expanded it into a http client.
In the header, it looks like we're using an http client with a single parameter.

/*** "GET <resource> HTTP/1.0\n\n" (the second newline is needed for the   ***/

However, right here it looks like we're sending a random meaningless string to a server.

/*---Make sure we have the right number of parameters---*/
    if ( Count != 3 )
        PANIC("usage: testport <IP-addr> <send-msg>\n");

However, what's really going on is we're grabbing a web page from a server by using it's IP address.
Here we grab the IP address (NOT A HOSTNAME) from "Strings" the command line arguments.

if ( inet_addr(Strings[1], &dest.sin_addr.s_addr) == 0 )

And here we tell the server which file we want on the server

sprintf(buffer, "GET %s HTTP/1.0\n\n", Strings[2]);

The full usage looks like this:

GET <xxx.xxx.xxx.xxx> </path/to/file.html>

To get /index.html from a web service on the same machine, you'd use:

GET 127.0.0.1 /index.html

Notice the space between the IP address and the file name!


Now to the second program.

Let's look at this block:

if (!strcmp(argv[i], "-f")){
                stdout = fopen(argv[i+1], "w");
                if(stdout == NULL){ perror("Check output file!"); exit(1);}
            }
            if (!strcmp(argv[i], "-u")){
                hostname = argv[i+1];
            }
            if(!strcmp(argv[i], "-p")){
                path = argv[i+1];
            }

Looking at this code it looks like your command line arguments go like this:


       
DeanMSands3 69 Junior Poster

File->New Project->Static Library.
It will create an .a file.
Reference that project in your linker libraries in your next project.

DeanMSands3 69 Junior Poster

Well, this goes back to 16-bit addressing (as revealed by your use of near).
In 16 bits, the size of an int (being 16 bits) is 2 bytes.
You increment it twice. But the compiler knows it's an int pointer, so it increments it by 2 each time.
So you're adding 4 to a value already holding 0xFFFF. Adding 1 to 0xFFFF in 16 bits rolls over to zero. What do you figure you have left?

DeanMSands3 69 Junior Poster

Well, I can't do that. (Or at least shouldn't.)
Here's a starting point. I put your first switch/case block into a function. I declared the function in the beginning and defined it later on. But to do this, I had to move your struct definition outside the main function to make it global. I also passed it two pointers. Notice that even this "rewrite" really isn't an example of good coding practices since the student s structure is open to use by any function instead of creating a local copy. But a local copy would mangle the computer's stack memory since local function variables are kept on the stack. But computers are resilient enough that's really not an issue I guess.

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>

struct student{
	char name[40],f_name[40];
	int age,clas;
	long int rnum, fee;
};
void addNewStudent(FILE *A, struct student *s);

int main(){
	struct student s;
	char stdname[40];
	long int recsize;
	FILE *A, *B;
	char another;
	int choice;
	A=fopen("fee.txt","rb+");	//Need to add check if A is NULL (
	if(A==NULL){
		printf("Could not read input file.\n");
		exit(-1);
	}
	recsize=sizeof(s);
	printf("1-Add new record \n 2-Display record \n 3-Edit record \n 4-delete record \n now enter your choice:- ");
	scanf("%d",&choice);
	switch(choice){
	case 1:
		addNewStudent(A, &s);
		break;
	case 2:
		rewind(A);
		while(fread(&s,recsize,1,A)){
			printf("\n %s %s %d %d %ld %ld", s.name,s.f_name,s.age,s.clas,s.rnum,s.fee);
		}
		break;
	case 3:
		do{
			printf("\nenter the name of student to be modified:");
			scanf("%s",&stdname);
			rewind(A);
			while(fread(&s,recsize,1,A)==1){
				if(strcmp(s.name, stdname)==0){
					printf("enter new name, father name, age, class, roll num, fee:");
					scanf("%s %s %d %d %ld …
DeanMSands3 69 Junior Poster

That's a good question. Now that I've had a chance to look at your code, I'm seeing what it's doing. I'm not thrilled with your way of doing things, but if it works, it works.
Each switch case modifies the file using different methods. Personally, I'd consolidate the bit where you write to the file into a single function or a set of function. And you really need more than one function.
But, like I said, if it works, it works.

DeanMSands3 69 Junior Poster

Oh! Well, your problem is simple. Take off the single quotes from the numbers in the case statements.
Number 1 has a numerical value of 1 where as '1' the character has a numerical (ASCII) value of 49 or (0x31 in hex).
Since choice is an integer, it's going off it's numerical value.

Edit: And also add a second "%d" for s.clas in line 35.

DeanMSands3 69 Junior Poster

First time compiling:

Records.c:36:1: warning: too many arguments for format [-Wformat-extra-args]

Have a look at that.


Edit: And yes, but make sure to exit out of the program.

DeanMSands3 69 Junior Poster

Use the |CODE| blocks to keep your code lined up straight.
This is the code with indentation, spelling corrections, and consistency edits. The code is functionally the same.

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
int main(){
	FILE *A, *B;
	char another; int choice;
	struct student{
		char name[40],f_name[40];
		int age,clas;
		long int rnum, fee;
	};
	struct student s;
	char stdname[40];
	long int recsize;
	A=fopen("fee.txt","rb+");	//Need to add check if A is NULL
	recsize=sizeof(s);
	printf("1-Add new record \n 2-Display record \n 3-Edit record \n 4-delete record \n now enter your choice:- ");
	scanf("%d",&choice);
	switch(choice){
	case '1':
		fseek(A,0,SEEK_END);
		another='y';	//Unnecessary
		do{
			printf("enter name , father name, age, class, roll num, fee");
			scanf("%s %s %d %d %ld %ld", &s.name, &s.f_name, &s.age, &s.clas, &s.rnum, &s.fee);
			fwrite(&s,recsize,1,A);
			printf("Add another ? y/n");
			scanf("%c",&another);
		}while(another=='y');
		break;
	case '2':
		rewind(A);
		while(fread(&s,recsize,1,A)){
			printf("\n %s %s %d %ld %ld", s.name,s.f_name,s.age,s.clas,s.rnum,s.fee);
		}
		break;
	case 3:
		do{
			printf("\nenter the name of student to be modified:");
			scanf("%s",&stdname);
			rewind(A);
			while(fread(&s,recsize,1,A)==1){
				if(strcmp(s.name, stdname)==0){
					printf("enter new name, father name, age, class, roll num, fee:");
					scanf("%s %s %d %d %ld %ld", &s.name, &s.f_name, &s.age, &s.clas, &s.rnum, &s.fee);
					fseek(A,-recsize,SEEK_CUR);
					fwrite(&s,recsize,1,A);
					break;
				}
			}
			printf(" modify another?");
			fflush(stdin);
			another=getche();
		}while(another=='y');
		break;
	case '4':
		do{
			printf("\nenter the name name of student whom you want to delete");
			scanf("%s",&stdname);
			B=fopen("tfee.tst","wb"); //Need to check if B returned NULL
			rewind(A);
			while(fread(&s,recsize,1,A)==1){
				if(strcmp(s.name,stdname)!=0){
					fwrite(&s,recsize,1,A);
				}
			}
			fclose(A);
			fclose(B);
			remove("fee.txt");
			rename("tfee.txt","fee.txt");
			A=fopen("fee.txt","rb+");
			printf("delete another");
			fflush(stdin);
			another=getche();
		}while(another=='y');
		break;
	case '0':
		fclose(A);
		exit(0);
	}
	return 0;
	getch();
}
DeanMSands3 69 Junior Poster

@Lerner: ditto.
@Ancient Dragon: Also ditto.
Cangan's code is a starting point. Nothing more. And that's what was asked for.
I'd replace the if statement with a switch/case block that catches vowels.
Lastly, the instructor says to use cin, but to break on the return. Cin accepts until return, but breaks the string on any whitespace. Unless you explicitly tell it otherwise. Getline, anyone? Eh, on second thought, give the instructor what they ask for, not what you think they want.

DeanMSands3 69 Junior Poster

Hm... I seem to have over-looked a few things.

First, you need to get both strings the same length.

Look at your code here.

int auglen = strlen(augend);
	int addlen = strlen(addend);
	
	
	if (auglen >= addlen)
		maxLength = auglen;
	else
		maxLength = addlen;

This won't work. You'll want to left-side pad the shorter one with zeros until their the same length. Then, after you do your addition, if the carry is still one, slide the 1 in on the side.
However, you'll need to do some messy string manipulation to do this. You'd need to do a string copy that starts at the end and works toward the beginning. Then insert the '1'. Memmove should do that for you. But then again, ONLY if the final string will fit in the size limits.

Of course, I'm dancing around the elephant in the room. That is, you could use a double ended queue and solve a lot of your problems. But that just creates more problems if you've never written one before.

DeanMSands3 69 Junior Poster

Well, look at what's happening to your pointer and it'll let you know.
I modified your code to do this.

#include<stdio.h>
#include<conio.h>

void main()
{
 int arr[3]={2,3,4};
 char *p;
 //clrscr();
 p=arr;
 printf("*p:%d, p: %ld\n",*p, p);
 p=(char*)((int*)(p));
 printf("*p:%d, p: %ld\n",*p, p);
 p=(int*)(p+1);
 printf("*p:%d, p: %ld\n",*p, p);
 //getch();
}

It gave me this.

*p:2, p: 2293552
*p:2, p: 2293552
*p:0, p: 2293553

Let's take it one step further.

#include<stdio.h>
#include<conio.h>

void main()
{
 int arr[3]={2,3,4};
 char *p;
 //Int size is 4 on 32-bit so cast arr as char* before adding.
 char *end=((char*)arr)+sizeof(arr);  for(p=(char*)arr;p<end;p++){
  printf("*p:%d, p: %ld\n",*p, p);
 }
 //getch();
}

Which, on a little-endian 32-bit system yields:

*p:2, p: 2293548
*p:0, p: 2293549
*p:0, p: 2293550
*p:0, p: 2293551
*p:3, p: 2293552
*p:0, p: 2293553
*p:0, p: 2293554
*p:0, p: 2293555
*p:4, p: 2293556
*p:0, p: 2293557
*p:0, p: 2293558
*p:0, p: 2293559

(Notice that the pointer shifted from 2293552 to 2293548. This is unimportant except to know that there are differences between the two programs.)

Hopefully, this is clear as mud and just as tasty.

Happy coding!

DeanMSands3 69 Junior Poster

You have a carry you're not taking care of after you parse everything. Try putting in leading zeros and see what happens (it should work). However, that's not how you want to do it. You'd need to insert the carry bit in the front and push the rest of the string back.

My recommendation is to read in 2 binary streams, convert them to integers, add them, then write them back out again as binary.

Happy coding!

DeanMSands3 69 Junior Poster

Hi, Yordan! Welcome to Daniweb!
Hope you can get your bar code scanner done. Myself, I steer clear of VB, but to each his own.

Happy coding!

DeanMSands3 69 Junior Poster

Oh hey! You got bots here too? I thought I left those behind in Webmaster Talk Forums.

DeanMSands3 69 Junior Poster

Welcome to DaniWeb. The only stupid question is a question un-asked. Or about Visual Basic.

Happy Coding!

DeanMSands3 69 Junior Poster

ADHD in IT? No, but definitely ADD.
What do I avoid? Anything involving backing up and making system-generic images for.
Not that I get out of it, mind you.

DeanMSands3 69 Junior Poster

Put your arrays in the heap.
http://www.learncpp.com/cpp-tutorial/79-the-stack-and-the-heap/

Also, write ONE sorting function, and pass a pointer to the array and the size to function. This will make your code MUCH cleaner.
Also, Dev C++ is kind of outdated. Try moving to VC Express, or NetBeans (w/MinGW) or Eclipse (w/MinGW).

DeanMSands3 69 Junior Poster

Oh fun. OK, so the computer will be watching the subject too? Yikes. OK, so ... Here's a few code samples I dug up in a Google search: tracking eye movement source code.
http://www.codeproject.com/Articles/26897/TrackEye-Real-Time-Tracking-Of-Human-Eyes-Using-a
http://joelclemens.colinr.ca/eyetrack/

You may need to bribe one of the CompSci at your university to help you.

DeanMSands3 69 Junior Poster

This maybe useful to help you understand:
http://en.wikipedia.org/wiki/MSDOS#Legacy_compatibility
http://en.wikipedia.org/wiki/Microsoft_Windows#History
http://en.wikipedia.org/wiki/16-bit_application
http://en.wikipedia.org/wiki/32-bit_application
http://en.wikipedia.org/wiki/64-bit_application

As you can see, Windows follows two family trees. The upper left tree is based on MSDOS, which is a 16-bit operating system. It required special software to allow programs to run in 32 Protected Mode. Windows 95, 98 and ME were built on top of MSDOS. They use 32-bit mode on top of 16-bit "Real Mode." Programs written for MSDOS will run on Windows 95, 98 and ME with few problems.

Now we come to present day. Windows XP is built on the Windows NT kernel. NT was built 32-bit from the ground up. It has nothing to do with MSDOS. It has to use a special emulation mode to allow MSDOS programs to run on it. And often, those programs don't work the way they should. That's why a group of people got together and wrote the program "DOSBox" and other MSDOS emulators.
With 64-bit OSes, support for 16-bit software is often dropped entirely. You will need to run those programs inside emulators.

Turbo C writes software for MSDOS. Those programs may or not run correctly in Windows. They might.

Visual C++ (newer versions) will generate software for Windows.
Other recent compilers will too (generally speaking). MinGW (based on GCC) is a popular free compiler that comes bundled with Code::Blocks.
It can also be used with NetBeans or Eclipse.

DeanMSands3 69 Junior Poster

OK, so it sounds like you want to put a dot on the screen and get your test subject to look at it even though their eyes are wired not to. Is that the gist of it?
If you're going to use C++ and you're pretty new to it, well... dang that's tricky.
DirectX is about as straightforward as unraveling yarn. While under water.

I would say use SimpleDirect mediaLayer (or SDL, libSDL, etc...), but that would require setting up linker libraries. And that's not always a straight forward process either.

DeanMSands3 69 Junior Poster

Be patient. It's still processing. It doesn't print until all the random numbers have been generated. Those sometimes take a while. Especially when there are a lot of them.

Compiled code with G++. Ran with CPU under moderate load. Finished in 14 seconds.

I'm not seeing any problems.

DeanMSands3 69 Junior Poster

I'm not seeing why you want to use A*.

Have a look at these instead.
http://en.wikipedia.org/wiki/Flood_fill
http://tog.acm.org/resources/GraphicsGems/gems/SeedFill.c