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

There will be no arks since its the end of the world. The end will come due to our sun exploding or collision with an asteroid, not because of a flood.

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

can u say me how to do it on a win32 program

Read this tutorial and you will find out how to do it.

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

I created a Flickr account -- thanks for the suggestion. Here is the URL (let me know if that link doesn't work for you.)

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

>>Is there any quick way i can do a goto line without seeking through the whole file or is that asking too much?

Depends. If it is a file that you want processed only once, then the answer would be no. But if you need to process the file multiple times either in the same or different sessions then maybe. What I have done in such cases is to create an index file that contains a key field and offset to that line in the original file. This index file is much smaller than the original cvs file, can be sorted after it is created so that your program can use binary search techniques on it (assuming the key file is a binary file). If you don't want to do that then the only alternative I have is to read the whole file serially until you get to the desired line.

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

I went to Chester, Illinois (home of Popeye) and took a few photos (only about 150 of them) and posted them on my Facebook page. There's too many to post here at DaniWeb. That town is only about 50 miles from where I live. Next trip will probably be to Superman's home town -- Metropolis, Illinois, about 140 miles.

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

I download Turbo c (zip file) from internet. But i can't install from install.exe
file. It is asking for disk 1. But my files are inthe c: drive. Please give any idea for install. My os is windows 7 ultimate. (so for it is a unregistered version) If the problem is due to this i have to purchase. Please give the solution.
Thank You
by sankar

Copy the files onto floppy disks and install from there. But you first need to install DosBox and install Turbo C from within that environment.

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

windows 7: use the mouse to highlight the text, press right mouse button, then select Oopy form the menu. Then open Notepad (or some other program) press right mouse button, then select Paste. Done. That method may not preserve formatting (line feeds and tabs).

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

Have you read this tutorial?

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

Where to get QT

OpenGL might be your best choice for cross platform.

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

Here is a complete tutorial on how to access database from MFC programs.

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

Yes, I'm starting a little early. Just finished off a bottle of extra-dry Champagne spiked with brandy. I had glasses for Dani, Narue. and Davy. I hope you liked it cause I sure did :)

31 Dec is also my last day at Wal-Mart. I decided to enjoy life for once. Want to visit Australia and visit the world's largest zoo, as well as some sights around USA.

Wish everyone at DaniWeb happy New Year :)

zeroliken commented: have a happy new year Ancient Dragon ;) +0
sergent commented: Happy new year! +0
Azmah commented: Wow! Congrats - You too ;) +0
jingda commented: Happy new year AD. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So what's the question?

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

mdas and dmas. So now we can happily interchange between division first, then multiplication first? I don't think so.
What's your say?

(10*2)/5 = 4
10*(2/5) = 10 * 6.6 = 60.6

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

Here's how (link)

CButton* pButton = new CButton;
pButton->Create( /* add parameters here */ );
hkdani commented: Quick, useful, practical, informative posts. +5
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Please post the structures.

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

Ok, here is the completed program. But don't turn it in because your teacher will know that you didn't write it.

#include <ios>
#include <istream>
#include <limits>
#include<iostream>
#include<fstream>
#include <string>
#include <vector>
#include <algorithm>
using std::cin;
using std::cout;
using std::string;

// clothing codes
struct codes
{
	char code;
	const char* explanation;
	float total_sales;
};
codes CODES[] = { 'A',"baby wear",0.0F,
	'B',"children wear",0.0F,
	'C',"ladies wear",0.0F,
	'D',"mens wear",0.0F,
	0,NULL,0.0F
};

struct RECORD
{
	int item_number;
	char code;
	float price;
};

const string filename = "jualan.dat";
int menu();
void AddRecord();
void ShowByCategory();
void ShowAll();
// This function from Naru's tutorial posted on DaniWeb
__inline void ignore_line ( std::istream& in )
{
	in.clear();
	in.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );
}


int main()
{
	int select;
	while( (select = menu()) < 4 )
	{
		switch(select)
		{
		case 1: // add a record
			AddRecord();
			break;
		case 2: //Display sales report for a category
			ShowByCategory();
			break;
		case 3: // Display sales report for all category
			ShowAll();
			break;
		};

	}
}

int menu()
{
	cout << "Family Outfit Shop\n"
		<< "MAIN MENU\n\n"
		<< "1)Add a record\n"
		<< "2)Display sales report for a category\n"
		<< "3)Display sales report for all category\n"
		<< "4)Exit\n";
	string input;
	bool failed;
	int select = 0;
	do {
		failed = false;
		cin >> input;
		for(size_t i = 0; i < input.length(); i++)
		{
			if( !isdigit(input[i]) )
			{
				cout << "Numeric digits only -- please try again.\n";
				failed = true;
				break;
			}
		}
		if( failed == false)
		{
			select = atoi(input.c_str());
			if( select < …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you writing an MFC or win32 program?

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

The first problem I see is that you need to surround the structure with { and } braces and put the typedef statement outside the structure

typedef struct menu RECORD;
struct menu
{
    void addRecord(RECORD input[], int arraycounter);
    void printRecord( input[]);	
    void printAllRecord( input[]);
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what are you trying to do?? If you just read the bytes from the file you don't need floating point matrix but unsigned char matrix as it will consume a whole lot less memory and more accurate.

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

This might be one place to start

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

>>And I also know that it's not allowed to declare functions in headers unless they are inlined

Wrong -- see your second example.

>>Will it still be inlined?
No (assuming lines 6-16 are in a *.cpp file and not *.h; there will be lots of other problems if you put that code in a *.h file).

>>And is there a keyword to explicitly specify to make any function not-inlined?
No. The default is not inlined. A method is only inlined if you explicitly ask it to be with the inline keyword or by coding it as in your first example. Even then there is no guarantee that the compiler will inline the code, inline keyword is only a HINT to the compiler, not a requirement.

sergent commented: thanks +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 43, the scanf() is wrong. Use "%s" (for string), not "%c" (for a single character). scanf() will not work at all if there are spaces in the filename. In that case call fgets() instead of scanf(), e.g. fgets(filename, sizeof(filename), stdin); Then you will have to remove the '\n' that fgets() puts at the end of the string.

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

Some colleges/universities have programming under two different departments: Computer Science in the math department and Computer Programming in Business Admin. Some also have computer programming in its own department. In USA it might also depend on which Bachelors degree you want: Bachelor of Science (lots of science and math) or Bachelor of Arts (lots of general studies).

CS with lots of math is what you want if you want to work for NASA to calculate an object going to a distant star. Programs heavy in graphics also require a lot of math. Most business related programs require nothing more than trig and college algebra.

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

This will work ok because it isn't trying to change a string literal

char s[] = "hello world";
*(s+1) = 'a';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm assuming client and server are two separate programs. Two processes can not share the same memory location. How to pass data between client and server will depend on the operating system. Its even more complicated when client and server run on different computers.

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

What have you tried? My first thought is to make window B and child of window A and set its coordinated within that of window A. You do that in the CreateWindow() function call.

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

If you are using Microsoft's MFC you can use a splitter window.

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

but you could edit out the link as he asked.

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

>>If I want to see the 3rd line in the file what I have to do?

You have to read the file sequentially until you get to the line you want.

>>could you please check the program and give me some feedback?
It's not really necessary for anyone else to check your program, you can do it yourself just by running it and see if it works or not.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
void findHighest(int numItems,string name[], double average[])
//loops through averages to find the highest average
{
	int index = 0;
        double highest = average[0];        	
	for (int i=1; i< numItems; i++)
	{
		if(average[i]>highest)
		    index = i;
		
	}
	
	cout << "Best percentage: " << highest  << " %"<< " by " << name[index] << endl;
	cout << " " << endl;
	
	
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why did you include stdafx.h? That's only needed for MFC programs.

Why did you write it in c++ if the requirement was to write it in C? To convert to C you have to

  • change the header files, include stdio.h and string.h. Others may also be needed depending on the program.
  • replace class with struct,
  • remove all class methods and access specifiers,
  • remove scope indicators all functions such as void dlist::printDListBack() renamed to void printDListBack() ,
  • pass class objects as parmeters to those functions
  • replace cout with printf()
  • replace cin with scanf() or getline(), depending on what it is getting from the keyboard
  • replace void main() with int main()

The above may not be an exhaustive list. Its going to take a lot of work on your part to convert that program. Good luck :)

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

How can you tell the difference between LABEL and OPCODE? If there are two words on a line, how do you know the first word is LABEL or OPCODE?

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

How the data is interpreted depends on the operating system. MS-Windows and *nix are opposite -- *nix interprets them left to right and MS-Windows right-to-left. That's termed endianness (see wiki article here)

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

The loop counter i IS the index value you want. Declare that loop counter above the loop so that its global to the whole function. Then on line 13 just use it name

line 4: change the data type of variable highest from int to double because array average is of type double.

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

>>i need the code in MASM615

And I need $1Billion too, but like you I'm not likely to get it without some effort on my part. Post the code you have written.

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

Just call sscanf() to convert the string, like this

int main()
{
   char text[] = "0x1C";
   int x = 0;
   sscanf(text,"%x", &x);
   printf("%d\n", x);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ftell() returns the position of the file pointer within a file, not the number of characters in the file. Each time you hit the Enter key getchar() will read that key too and write it out to the file. MS-Windows operating system changes the '\n' (Enter key) to '\r' and '\n' (two keys instead of one).

Try typing characters without Enter key between them and the count will be different.

If you want to know how many characters are in the file just keep a counter to count them. Or you can re-read the file and then count them.

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

cin is getting an error on the first character because it is not numeric digit. You declared variable character as int, so cin expects to read numeric digits. Change the data type of character to char and it should work as expected.

Suggestion: Change the while loop to read all the characters in the file

while( cin >> character )
{
   cout << character << endl;
   ++count;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Add a line at the end of main() (e.g. cin.get() )to keep the window open

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

>>is it not safe to assume the following?

No. You could typedef s16 = long if you want to.

>>could you not just use the defined values for windows C, and if need be, the type definitions in "windows.h"

No because windows.h does not define those either.

>> instead of using a cross compiler
Code::Blocks is not a cross compiler. It won't generate code for another computer architecture. AFAIK Code::Blocks is only supported on PCs with IBM/compatible processors.

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

That has been a common problem for many years with MFC. The way to solve it is to hook the keyboard event and ignore the Enter key.

Here are a few more suggestions

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

Microsoft compilers do not define s16, s32, or u8 so you would have to typedef them yourself if you want to use their compiler. I think the best compiler for you would be Code::Blocks and MinGW compiler, which is supported on by *nix and MS-Windows. MinGW compiler has already ported most *nix libraries to MS-Windows.

>>It's common to assume when coding for *nix that you can rely on POSIX compatibility;
MS-Windows is not POSIX compatible.

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

Is .NET framework installed on the XP computer? As for Win7 computer, inpout32.dll may not be compatible with it -- just a guess. If you google for that library there is no mention of any version of MS-Windows newer than XP.

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

I'm not into this kind of games but I showed this thread to a friend who is into them and he told me that bodyguards are not all that unusual in online gaming, but what is unusual about this one is that the bodyguard is a 15-year-old kid.

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

controller.h has no clue what registration is.

db.h -- you will have to rename that function because register is a c++ keyword.

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

why doesnt getch() ,cin , cout etc work...?

They work great when you include the correct header files.

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

maybe banned users should not be included in that list

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

Also, your program is not saving the Registered name/password anywhere, so when you start the program and just select Login where is the registered name/password supposed to come from?

And what's with all those Sleep()s? The program isn't actually doing anything when it displays "Loading ..." so why waste everyone's time with that nonsense.