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

>>how do i tell my compiler to use the 32 bit address as a flat address and not as (base:segment).

You don't

>>have a program in which i would like to hardcode the address greater than 1MB, after enabling A20, and ask the compiler to use all the pointers that i hardcode the address above 1MB to access directly with out considering it as base:offset.

You can't do that directly either. But you are in luck because you can use an EMS driver if you are running true MS-DOS Version 6.X or earlier. Otherwise if you are using Windows XP you might consider using the XP Ramdisk

Another option if you are using Windows 2000 or newer is to upgrade your program to use modern 32-bit compiler then your program will not have the memory restrictions that VC1.52C has. Nice compiler -- I used it for several years. But its an old ancient fossel that doesn't work well on modern computers.

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

Assuming you are writing a C console program then use the system() function. MS-DOS has been dead on PCs for 10+ years now, but still used in some old embedded systems.

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

Oh, where is the explanation? :(

In the ISO standards -- read Salem's post above, but I guess you did not or you would not have asked this question.

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

just create a loop that counts from lower_bounds to upper_bounds, and check the value of the loop counter if it is a prime number or not.

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

>>but it does not work properly when I check the string length
Just add code to call strlen() to get the password length the check if it is <= 9. If you really wrote all that code you posted you should have no problem checking for length.

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

your code contains a lot of syntax errors. Plus the formatting stinks. Here's the cleanup of syntax errors.

class fun
    {
public:
	enum U1{stone=0,scissors,paper};

private:

	U1 User1,User2;

public:

	void setuser1(U1 ch1){
	User1 = ch1;	
	}

	U1 getuser1(){
	return User1 ;	
	}

	void setuser2(U1 ch2){
	User2 = ch2;	
	}

	U1 getuser2(){
	return User2 ;	
	}

	void display(){
                cout<< " the first player choose " << getuser1() << endl;
                 cout<< " the second player choose " << getuser2() << endl;
	}

	int wins(){
	int score_u1=0;
      	int score_u2=0;

   for (int i=0;score_u1 < 3 || score_u2 < 3;i++){
     if ( getuser1() == getuser2() )
	return 0;
     else if(getuser1()== stone && getuser2()==scissors){
	  score_u1+=1;
	  return 1;}
     else if(getuser1()==scissors && getuser2()==paper){
	  score_u1+=1;
	  return 1;}
     else if(getuser1()==paper && getuser2()==stone){
	  score_u1+=1;
	  return 1;}
     else if(getuser1()==stone && getuser2()==scissors){
	  score_u2=1;
	  return 2;}
     else if(getuser1()==scissors && getuser2()==paper){
	  score_u2=1;
	  return 2;}
     else if(getuser1()==paper && getuser2()==stone){
   	  score_u2=1;
	  return 2;} }
   return 0;
	}
     };

int main(){
    fun play;
	int ch1,ch2;

    cout<<"first player .. please enter your choies 0 for stone and 1 for scissors , 2 for paper";
    cin>> ch1;
    cout<<"second player .. please enter your choies 0 for stone and 1 for scissors , 2 for paper";
    cin>> ch2;
//
// TODO:  Add some error checking here to insure theat ch1 and ch2 are in range
//
//
    play.setuser1(static_cast<fun::U1>(ch1));
    play.setuser2(static_cast<fun::U1>(ch2));
    play.getuser1();
    play.getuser2();
    play.display();

switch ( play.wins() )
{
case 1 :
  cout<< " the first player wins ";
	break;
case 2 :
cout<< " the second player wins ";
break;
case 0 …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How about

enum objType {stone,scissors,paper};
	objType User1;
	objType User2;

That's generating actual objects called User1 and User2. What you want to do is typedef them

enum objType {stone,scissors,paper};
typedef objType U1;
typedef objType U2;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

moved

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

enum getuser1(){ <<< wrong User1 getuser1() <<< right

Are you REQUIRED to use enums in this assignment? If not then it would probably be easier just to use const int for each

const int stone = 1;
const int paper = 2;
const int scissors = 3;
...
...
int getuser1();
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i think i created the wrong program..it should read each digit not convert it into integer...

In that case just scrap whatever you posted and try again. If you want our help you will have to re-post the program's requirements, and don't just try to paraphrase it.

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

You can not use atoi() because it returns an int which is probably too small to hold 20 digits. But you can use a 64-bit integer to hold the number and convert the string yourself.

>> char c[20] ;
Too small to hold 20 digits, you didn't leave room the the null terminator. Besides, use std::string if you are allowed to.

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

>>Are you talking something along the lines like this, to eliminate all the numbesr divisible by two
I don't know -- all I know is what you posted.

>>how would i print the subscript of the array if it is set to 1?
Simple -- create another loop that looks at all the elements of the array, not just every other one, check if its value is 1, and if it is then print the value of the loop counter.

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

Screw the WGA -- we watch too much TV anyway.

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

Sorry Thinker but you program doesn't hack it. Its full of syntax errors and undeclared variables, and it just plain doesn't work right. Line 10 does NOT calculate the sum of the digits. If the input number is 15 then the sum of the digits is 1 + 5 = 6. You are on the right track with line 9 but you flunked the course with line 10

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

First since this is c++ you should use std::string, not c-style character arrays because it will make your life a lot simpler. The class std::stringstream will help you split the line into individual words, and finally you can use std::vector to same the list of all words in the file. If you search this c++ board for stringstream you will find examples of how do do all that because it was posted just the other day.

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

Your description of the problem doesn't make sense. First you say to initialize all elements of the array to 1. That's simple enough to do.

for (int i = 0; i < arraySize; i++)
    a[i] = 1;

>>Starting with array subscript 2, every time an array element is found whose value is 1
Well since we set all elements to 1 as above then the 2nd subscript will be 1. So your program should set elements 2, 4, 6, 8, 10, ... 5000 to the value of 0 and leave all others alone.

for (int i = 2; i < arraySize; i += 2)
    a[i] = 0;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

strcat() concantinates strings, not single characters. you can do a simple assignment for that

char s2[MAX] = {0};
for(int i=0; i < MAX ; i++)
{
    if (line[i]=='\0')
         break;
    if ( line[i] != ' ')
          s2[i] = line[i];
}

The above will fix the syntax error but not the logic error. All the above does is extract the first word from the input string. What are you going to do the the rest of the string?

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

If you'd use IE7 on Vista you wouldn't have to worry about those annoying popups. I never get popups (well almost never) unless I click a link to allow them for the current site, including DaniWeb.

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

Dunno, there's been half a dozen or so trolls all posting verbatim copies of wikipedia and other online resources, often in repeated replies to their own messages.
The management should conduct a ban and sweep on them.

already did that :)

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

>>Could you give some link?
Certainly. Logical place is mysql site? I believe they also have a users group or forum you can join to ask specific questions about mysql.

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

>>I get the program to run
No you didn't because there are syntax errors on lines 30, 53 and 60. So if you ran a program it was not the code you posted. Line 30 should have been coded like this: if (choice == 'B' || choice == 'b') and the others similar.

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

So where did you code the function in line 16 ?

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

but get_invoiceAmount isn't returning anything...it's working like the displayMessage examples they give in the book

It's not supposed to work like displayMessage() -- read your instructions. displayMessage is not supposed to return anything, get_invoiceAmount() is

"int get_invoiceAmount" that's what i understand you are telling me to do, am i correct??

Yes that is right.

hmmm, i thought it was easy to see
PN - product number
PD - product description
QP - quantity purchased
PI - price of each item

Maybe to you because you wrote it.

so i have the QP*PI in my get_invoiceAMount, but my data members don't seem to be receiving what i send them in main when i create an object

you need to do something like this in main()

int invoiceAmount  = invoice1.get_invoiceAmount();

do you mean separating the interface & implementation? putting the constructor into it's own header file?

No, leave the class where it is an just add another constructor.

class Invoice
{
public:
    Invoice() {QP = 0; PI = 0;}
...
};

i'm going to try doing this from the start again cause now i'm getting even more errors lol
BBL

post code

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

and avoid using conio.h because it isn't needed in c++ programs.

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

>>do i have to use the get function to get the numbers from the user?
No -- get functions return the value of private members to the calling function or class. For example get_invoiceAmount() should be an int function that returns the invoice amount (re-read your instructions on this). With your cryptic variable names I can't tell you how to calculate the invoice amount.

I think getting values from keyboard entry should be done in main(), outside the class.

You should add a default constructor (one with no parameters) and initialize all class variables to 0.

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

line 36: delete the endl from that line because it doesn't go with cin. But because i is an int you will probably have to flush the '\n' from the keybord buffer, so add cin.ignore() after line 36 and before line 37.

line 37: delete this because there is no need to increment the value of i.

line 39: should be while( i != -99) because that's what your instructions say.

What you are missing in the loop is a counter that keeps track of the minimum value entered.

>>If A is chosen, you should ask the user how many numbers he wants to enter
You have not done that yet. And you need to use another int variable to keep track of the largest number entered.

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

Turbo C Ver 1 also prints, so it's probably a bug at least through ver 3. Borland 5.5 works as expected.

As reported earlier I used TC Version 2.01 and it did not have that problem.

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

chicken & egg proglem

If the file contains binary representation of integers then the bytes may have to be reversed on the receiving os. This is common problem when transferring files between MS-Windowos and *nix/Unix -- big endian little endian

As for your specific question -- I don't know, sorry.

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

did you look at those errors and make any attempt to fix them yourself? For example, the error on line 33: you have misspelled the keyword while. Now, look again and see if you can't see what's wrong.

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

>>what is size_t . is it something predefined datatype.
Yes -- most compiler define it as either long or unsigned long. But compilers are free to define it however it wants, uncluding long long

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

line 4: function names can not contain embedded spaces. Either delete the space or replace it with '_' character.

And the first parameter is coded incorrectly. Looks like all you want is a pointer to a double, not an array of doubles

int grade input (double *a, double *i)

line 6: I don't know what that is but it should be this scanf("%lf", a); line 19: again use "%lf" in the format string.

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

You might browse this list to see if there is anything useful to you or give you ideas of how to write your on VC++ add-on macro

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

>>it isn't the best thing to mix io functions from different families
but scanf() and fgets() are of the same family of functions, all declared in stdio.h But it is NOT good to use scanf() for string input because it can (potentially) corrupt and possibly crash your program if you enter a string that is longer then the buffer size you want to hold it.

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

teach me how to format my program befor posting

Its really simple, just put [code=c] at the top and [/code] at the bottom.

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

I just tried it with VC++ 2005 Express and TC (the original I think, dated 1989). Neither compiler had the problem you report.

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

>>I want to track a time I spend on each project
Use your watch and enter the times in an Excell spreadsheet. Or maybe something like this, which you have probably already seen.

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

OMG! my comments here apply. I have no intention of trying to help you any more, you are now on my ignore list unless you at least post something that YOU have done.

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

I suppose you think we are that stupid? That isn't your program because it does not do anything that is required in your assignment that you originally posted. We aren't as dumb as you might think we are.

Trash that entire program and begin a new one. This time we want to see YOUR work, not someone elses.

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

well, I can't read your mind -- where is your code ?

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

>>i have no idea on how to go about it,
start here. Now fill in the function shown below with your program requirements. Do only one little part at a time, compile and correct all errors. Then do a little more and repeat until all requirements have been fulfilled.

Example Write a c program that inputs the names of the 5 students . That tells you that you need to create an array of strings that will hold 5 student names. Do just that much and then compile.

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

int main()
{
    // your code goes here
 
   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i think the user must confident about his question or answer or what ever he done in the site,the userdo not take the qustion and answer it silly.

Would you like to translate that into English for us normal-English speakers?

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

It is standard win32 api function. Scroll down to the bottom of the page and it will tell you what libraries are required.

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

header files are somewhat like books -- they contain information about a specific topic. For example stdio.h contains information about files and the functions needed to create, read or write to them. As with a book library there are thousands of header files which are normally placed in a commin directory.

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

There are several ways to create threads, depending on the operating system. MS-Windows can use CreteThread() win32 api function, or _beginthread(). I've always used CreateThread() in my windows programs. Its not really all that difficult and you should be able to use google and find lots of examples.

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

you can not do MFC with the Express edition of the compiler because the libraries are not included in the Windows PSDK. You need the Standard or better version.

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

is there some where i can find out about the diferent \'s? i know \n and \r now, what other ones are there?

here

>>I am also working on the user input problem, will update every one once i figure something
I would create another thread and put the timer in that thread then you can use normal standard input functions in the primary thread.

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

>>But in case you don't have a book...
Buy, Beg, Borrow or Steal one.

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

looks like it might be html, but not certain

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

I just tried it and the IDE does not have an option to include more than one project in the same solution, or maybe I just don't know how its done. I do it a lot with the Pro edition, but don't see it in the Express edition.

So zip up your project after deleting all compiler-generated files and post it and I'll give it a try.