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

same problem as in old days. when you enter a number and press <Enter> cin does not remove the "\n" from the keyboard -- you have to do that

int x;
cin >> x;
cin.ignore(); // remove '\n' key
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ok, how do I get the assembly compiler?

read assembly thread -- there are some links there. But assembly is probably not what you really want to use because (1) its the lowest-level of all programming languages (2) not portable to any other operating system, and (3)requires about a gazillion times more work than other languages.

My suggestion is to learn C or C++ (or both). See earlier posts in this thread for suggestions. Also follow the links in the Starting C thread in the C/C++ board.

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

Here in St Louis they usually rerun it when its midnight central time zone. I've watched it here every since I can remember. Years ago we also watch all (or many) live big-band parties in various cities. Unfortunately TV doesn't do that any more -- what a pitty young people will miss that tradition.

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

The values you put in the array are not relevent to your problem. I suspect the actual error is elsewhere in your program because what you posted looks ok. Without more code its impossible to say what your problem is.

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

please post how the array was declared, or better yet post the entire function. what's the max value of each dimension?

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

I am not using args in the first program...just "cin>>" is there a way to still do this...withouth the args?

See my second example. put the numbers in a text file then redirect stdin from that file.

Another method is to use pipes. Here is an example program. The example opens the pipe for reading -- but in your case you will want to open it for writing because you want to send the other program the numbers.

Here is a working example for MS-Windows os

// program A 
#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{
	int a,b;
	cout << "Enter first number\n";
	cin >> a;
	cin.ignore();
	cout << "Enter second number\n";
	cin >> b;
	cin.ignore();
	cout << "a: " << a << " b: " << b << "\n";
	return 0;
}
// Program B.  This will send two numbers, 12 and 13, to program A.
#include <stdio.h>
#include <stdlib.h>



int main(int argc, char* argv[])
{

	char *cmd = "..\\progA\\debug\\progA.exe";
	FILE *ptr;
	if ((ptr = _popen(cmd, "w")) != NULL)
	{
		fprintf(ptr, "%d\n%d\n", 12, 13);
		_pclose(ptr);
	}
	return 0;

	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What is a good language that can easily make applications, has the ability to read mouse clicks on certain places, can make highly detailed pictures, is just as mathematicaly abled as dev-pascal, and can easily make a program using Artificial Inteligence, a new compiler, or a user interface?

:mrgreen: Is that a trick question?

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

Here are several MFC button controls -- if you are using pure win32 api functions you can just strip out the MFC code and call win32 api functions directly.

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

There are a couple ways you can do it.
1. The program that is to get the numbers should get then from argv. The program that passes the numbers just passes them in the argument list as if you passed them on the command line.

// Program A
int main(int argc, char **argv)
{
  int n1, n2;
   // This program expects to get two numbers in argv.  
   // So the value of argc must be 3.
   if( argc != 3)
   {
     printf("wrong number of arguments\n");
     return 1;
   }
   n1 = atoi(argv[1]);
   n2 = atoi(argv[2]);

   // now do something with the two numbers not shown



   // exit the program
   return 0;
}

This is program 2

int main()
{
   // send program a.exe two numbers -- 12 and 13
    system("a.exe 12 13");

    return 0;
}

2. Another method if program a.exe is already written to get the two numbers from the keyboard then program b should write the numbers to a file and redirect the input for program a to the file.

// program b.exe
int main()
{
     fstream out(myfile.txt);
    out << "12\n13\n");
    fclose(out);
    system("a.exe <myfile.txt");

   return 0;
}

There are other solutions as well, but I think the above are probably the easiest to implement.

SpS commented: This guys really helps ~~SpS +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Happy Birthday -- hope you have many many more :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
{'J', 10},{'Q', 10},{'K', 10},
    {'A', 1}

The above are all wrong. the values of J, Q, K and A are incorrect, should be 11, 12 , 13 and 14 respectively.

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

Heh..I knew that, just wanted to tell you that it is not a normal way of reading posts and many members will get confused...;)

BTW have fixed the code so that it can be read by each and every person.

Appears we need to have Ms. Dani add a new category to the Rules thread -- do not make hidden posts. I don't know how he did it, but than you ~S.O.S~ for fixing it up. :)

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

lol....he was just pressing enter

So can you give me source?

Don't you ever read the posts to your thread? :eek: I already gave you the win32 api function call for MS-Windows os. Just click the link I posted and you will get everything you need to know about that function. include <windows.h> to use it.

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

So, in otherwords you bought this game (or Santa gave it to you) and you want someone to tell you how to run the game from the hard drive without having the CD in the CD drive?

Smells like it might be illegal.

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

>>cin >> cardname[ORDER][COLUM];
I don't understand the problem you are trying to explain. But above line is certainly wrong. The array has 3 rows and 4 columns. Rows are numbered 0, 1 and 2, and the columns are numberd 0, 1, 2, and 3. The line above is trying to access row 3 and column 4 which do not exist.

The second problem with that line is that it will alow you to enter a something from the keyboard that will destroy whatever was in there before. If that was your intent then its ok.

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

I think the Op's original problem has been solved -- see his post #5 and 6 to this thread.

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

An older C/C++ compiler can build these programs even on Windows XP machines

That is not what I said. I said those interrupts can only be used in 16-bit MS-DOS programs, which requires a 16-bit compiler. The interrupts can not be used if the program is built with any 32 or 64 bit compiler targeted for either MS-Windows or *nix.

That's not quite true. You don't really need to know assembler as long as you know how to access the REGS structure. It's all taken care of for you.

Well, tell me how anyone can now how to populate the REGS structure if he knows absolutely nothing about assembly language??? True he doesn't need to know about many assembler instructions, but he does need to know a lot about the interrupts he is attempting to access.

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

Where would i be able to purchase visual basic or a similar .EXE creator? is there any free versions?

Here

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

Thanks for reply. You are probably right that I'm missing some goodies staying with an old compiler, but I don't want the cost of a new one, or learning a new environment.
In spite of the bizarre error messages, it turned out to be a simple coding error.

cost is no excuse -- some such as Dev-C++ are free.

>> or learning a new environment
If you want to do this as a hobby that's ok. But no company uses that compiler any more.

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

look at an asscii chart and you find that the ascii value of the letters 'a' to 'z' are 97 thorugh 122 respectively.

This will return a character beteween 'a' and 'z'. Use the same technique to get a number between 1 and 10.

rand() % ('z' - 'a' + 1) + 'a';

>>But what i want is to mix two type together by rand().
put the above in a loop and on every other loop iteration generate a character and on every other loop iteration generate the integer. Use the mod operator on the loop counter to determine which one it is

Here is a short tutorial on random numbers that may help you.

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

Hi everybody,
How to crack a password of a simple C++ Programme?
Please give me a simple code sample?????????
heres to,
Nuwan

passwords are encrypted for a good reason -- to keep people like you from reading them.

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

you "monitor" the clock just as I described -- just poll it every minute. There are interrupts which you can hook that will call the interrupt function you write every clock tick, but that is way too often for your purose (18 to 100 times per second).

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

Wow, how did you find it? Hard? I'm kinda thinkin about the "old do new trick thing here"

Yes I did find it difficult -- those were the days before internet and DaniWeb, so I had to learn mostly by myself, and I learned a lot of things incorrectly as you might imagine. Young people today have the equivalent of personal tutors right at your finger tips (keyboard).

And yes, you can teach old dogs new tricks:cheesy:

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

baud rate described here

>>? Why we cannot transmit data than that (maximum ) data rate?
how fast can you talk? why can't you talk any faster?

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

pseudocode and flow charts are two different things. see link for description and brief examples.

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

12) what are the I/O ranges?funcitons of it? is it useful to a programmer ? if How ?

13) can we use a C++ programme without windows? I mean can we use C++ programme in MS-DOS mode?
Can we run a C++ programme before windows boots?if can how to do it………….I have no idea?

c++ programs must be run under SOME operating system. You can not run them before an operating system has been booted, unless of course you are writing your own operating system. You could, of couse, install MS-DOS 6.2 operating system on your computer if you want to run true MS-DOS. The console window that you can get with MS-Windows is not true DOS, but an emulated MS-DOS.

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

0x10 is an interrupt vector, which is a hard-coded memory address where an interrupt handler begins. This can only be used in old 16-bit MS-DOS programs.

Here are assembly language tutorials. If you want to learn interrupts then you will need to know basic assembly language.


Here is information about int 21 functions

If you google for "dos interrupts" you will find info on other interrupts.

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

And I thought I was old when I started at the age of 35 :cheesy:

Serious, did you really start at 40 and made it your career AD?

yes I did. I didn't get started until after I retired from the US Air Force in 1985. Bought a book and a cheap computer. started reading and practicing.

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

you already have a schedule of doctors and times. Convert the times from HH:MM into just minutes for easy comparison. For example: 5:14 AM is (5*60)+14 = 314 minutes into the day.

beginning of loop:

  get current time, convert current hour and minutes to just minutes and compare it with the time in the schedule.  

IF curtime >= Dr. E time
    diaplay Dr. E time
else if curtime >= Dr. D time
    diaplay Dr. D time
else if curtime >= Dr. C time
    diaplay Dr. C time
else if curtime >= Dr. B time
    diaplay Dr. B time
else if curtime >= Dr. A time
    diaplay Dr. A time
else
   display nothing

delay for 1 minute then return to top of loop

>>.STOCK 100
should be STACK, not STOCK

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

Dam edit button! Sorry Irfan I didn't mean to edit your post. At least I didn't destroy anything

that's a great idea!:idea: But I'll bet you soon get millions of spam faxes in your email

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

My NY resolution is to keep it for at least 30 days

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

Santa brought me a big and nice finger ¬¬ (nothing)

Naughty all year huh?:eek:

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

None of the win32 api functions I'v used take smart pointers as a parameter or pass them back. Why? because they can all be called from other languages which know nothing at all about c++ smart pointers.

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

got a cell phone, now I just have to learn how to use the blasted thingamabob.

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

ah, but I just got a job with Microsoft, so I'm pretty sure I'll be using it ;)

Congratulations! I understand its pretty difficult to get jobs there. Yes, I suppose you will indeed be using it.

That's odd. Companies normally buy pc's with the operating system already pre-installed before it ships. So when you buy a new pc in 2007 isn't it going to have vista already on it?


Congrats :cheesy:

We don't buy new PCs all that often. I've had mine for four years now and when we bought it the PC did not have the os preinstalled because our IT people wanted to install it themselves (for whatever reason).

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

Don't bother with MFC.

You will probably have to know it because there are millions of programs out there that use it. I use MFC all the time and don't have a problem with it any more -- it has a very very steep learning curve, up to a year ot more. Today, new projects would be easier if written with C# or Forms.

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

1. create an MFC Extension DLL

2. In the .h file, define a macro similar to below

// The following ifdef block is the standard way of creating macros which 
// make exporting from a DLL simpler. All files within this DLL are compiled 
// with the __GXDLCODE_EXPORTS__  symbol defined on the command line. This 
// symbol should not be defined on any project that uses this DLL. This way 
// any other project whose source files include this file see GXDLCODE_API 
// functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef GXDLCODE_EXPORTS
#define GXDLCODE_API __declspec(dllexport)
#else
#define GXDLCODE_API __declspec(dllimport)
#endif

3. In the .h file where your class is declared

class GXDLCODE_API MyClass : public CDialog
{
   // your class code here
};
John A commented: Where'd all your knowledge come from? :) --joeprogrammer +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I wouldn't be too sure about that. The company I work for does not upgade for about two years after a new release.

And here is one big reason why we don't upgrade immediately:eek:

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

did you compile and run the program to see what it does? Requires Turbo C compiler.

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

To revise my first post in this thread, I will certainly be using it when I start working in 6 months,

I wouldn't be too sure about that. The company I work for does not upgade for about two years after a new release.

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

That shouldn't matter one bit. The header files are pulled into the source before compilation and therefore splitting them up doesn't influence the footprint of the compilation unit.

It would only matter if for some reason a header file was too complex for the preprocessor to handle, but when split into smaller chunks can be handled.
That however isn't the case here.

agree -- you only put the extern declarations in header files, not the actual instances of the objects. The actual instances of the data must not exceed 64K in any one *.c file.

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

please read this thread. which provides a wealth of information for beginners.

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

Hmm...you are forgetting that names is an array of strings and not a std::string or a vector. So you can't apply the size( ) function to it, it is applicable to C++ containers, not array of containers. The only way to do this thing correctly is to do it like specified by Miss Narue in the second post.

Yes you are correct -- my mistake. Best thing for the op to do is use a vector instead of an array. I was wondering at the time how Narue could possibly make such a mistake -- turns out she didn't.

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

I think I am young enough [22] to start now. .

Its never too late to start. I was 40 when I started, but it is a lot better to start at a much younger age.

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

Can't seem to figure this out.

string *array;
 
void addNodes(string names[])
{
	array = names;
	//how many elements in the array???
}

std::string has a function size() that will tell the current size.

void addNodes(string names[])
{
	cout << "size of array is " << names.size() << "\n";
}

>> array = names;
That does not work because you variable names is a c++ class, not a pointer. If you want the pointer, then use c_str()

const char* array = names.c_str();
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well... heres me :-|

I may look like a kid.. but im almost 17 *** damn it! :p

You may not realize it now, but 17 is just a kid :mrgreen: Don't be in such a big hurry to grow up -- take your time and have a lot of fun.

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

You should study this MSDN article. I think it includes some example too.

[edit]Just noticed the link is for VB .NET, not VB 6. This might give you a start. I'm sure there are many examples. [/edit]

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

Look in your text book how to access database objects. You are trying to learn VB with a book aren't you ??? If not, you should be. Also try to get initialize answers from google, which is getting pretty good at answering programming questions. For example , ask for "vb database" and this will be the first link you get.

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

Thank you very much, I really get new concepts about the interrupts
Since you replayed, I have tried many times but I get errors in every time
Because the pages you gave me about MSAM

I want the code with tasm since that it is the only I know
I am beginner
At least I want the code to convert from hex to dec also how to show the result on the screen

Any help I would appreciate
Your forum is the only one that gives me an answer
Thank you

If you tried several times you need to post your code so we can help you. Just giving you the code will not help you very much.

I believe task has a command-line switch you can set that will make it correctly interpret masm code. Its been too many years since I used it and don't recall what it is. And there isn't really all that much difference between tasm and masm, you should be able to easily interpret them youself anyway. 80x88 code is the same with all assmeblers.