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

I am sorry for my mistake...I had no idea I HAD to encase the code in tags...I thought it was optional.

It is optional, DaniWeb does not enforce that rule, but moderators do. -- If you don't follow the rules then you will greatly decrease the probability that anyone will take you very seriously and answer the question. Many people see unformatted code and just ignore the whole thread.

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

>>if (Compare1 == Compare2)

you can not compare C character arrays like that. All that is doing is comparing two addresses, not the strings. use strcmp() for that

if( strcmp(Compare1, Compar2) == 0)
{
   // the two strings are the same
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

my apologies about the code, I did not compile or test it. There is no such function as fsprintf() -- it should have been fscanf().

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

Yaa.. i'll stick to C.. do as per urs and Mr.Dragon's advice, chk out how it goes...Thnx a lot again both of u all !!!

It all depends on the class you are taking -- is it C or C++ ? You have to write your program in the language required by your instructor. And as Joe mentioned, do not mix the two languages.

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

Thnx Joe... I followed ur suggestions, the errors ve all disappeared but the thing is "how do i include iostream" ???? is it a header file... am very sorry, diz mite sound silly but then i seriously dunno much abt C..am just learnin it now by practice..

Now i got the error:

Fatal Error: C1083 : Cannot open include file - iostream.h

Confusion abounds -- are you writing a C or a C++ program??????? The code Joe posted and the code I originally posted is C++, not C. They are two different languages, and you must know which you want before you can write your program.

iostream.h is an obsolete file. use the header file without the .h extension. For c++ programs only

#include <iostream>
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh, I see you are writing a C program, not a c++ program. What I posted will not work. You will have to use character arrays instead of those c++ string classes.

Read you text book about printf() function to find out how to print something on the screen. I would like to give you the complete solution to your assignment, but if I did that you would not learn a thing. Programming is very time consuming, not like just reading a novel.

I did not compile this, and hopefully it does not contain too many errors.

# include <stdio.h>
# include <stdlib.h>
# include <string.h>
 
int main()
{
  FILE *in_file;
  char dataFile[20];
  char date[20];
  char operator[30];
  char ts[80];
 
  printf("Ënter file name");
  scanf ("%s", dataFile);
 
  in_file = fopen(dataFile, "r");
 
  fsprintf(in_file,"%s %s", date, operator);
  fgets(ts,sizeof(ts), in_file);
 
 
  if ( strstr(ts,"Vendor Setup" != NULL)
  
   {
      printf("Data found");
   }
  
   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use ifstream's extraction >> operator to get each of the first two strings, then call getline() to get the remainder of the line into a single string. Then just check the last string for what you want

std::string date;
std::string operator;
std::string ts;

in >> date >> operator;
getline(in,ts);

if( ts.find("Vendor Setup") != string::npos)
{
   // text was found
}

Of course you will have to put all the above in a loop so as to read the whole file.

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

show a couple sample file entries. what you posted tells us very little. But basically you have to read each line of the file and check the task column. there is no one way to do it, so you have to know what the file really looks like.

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

variable theFile contains the name of a file on disk, it does not contain the information that is in the file. the open function will just open up the file so that the program can read it -- the open function does not actually read the file. To do that you need to either use the stream's extraction operator >> or call its read() function. What is the purpose of all that code after the open() function? It appears to be completly useless.

isalpha() just checks to see if a character is alphabetic -- that is if the character is one of 'a' to 'z' or 'A' to 'Z'. any other character will fail the test.

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

I don't know how its done, but here is an example

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

>>How do I organize the input alphabetically?
there are at least two ways I can think of:
1. use a linked list, insert the new name in alphabetical order. The program will have to search all the nodes in the list to find the right spot.
2. similar to #1 above, but use a dynamically expanding array of strings instead of a linked list.
3. Find out how many names are in the file then allocate an array of pointers of that size. Read each string into the array without regard to alphatetizing. After file has been read sort the array using on of many sorting algorithms.

#3 above is the one I would prefer because I think it is the fastest. Not very much searching involved, which can be pretty slow with large arrays.

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

maybe I am being too simplistic, I don't know, but why not just create a few simple queries in the mysql database and save the results to files on the local computer ? I know there are free mysql tools that will allow you to do that. I do it on my own XP computer, and I assume it might work on a remote database where you have administrative rights.

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

>>scanf("%c,%d,%d,%d",&status,&defect,&chnum,&w_cond);
The problem is here: replace the commas with spaces.

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

please edit your post and enclose the code in code tags. Read the links in my signature if you do not know how to do that.

Also what are specific questions?

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

Before you jump into windows programming with both feet, you should read this intoductory tutorial.

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

Mr SOS -- it works up to a point -- gives the famous message box that a fatal error has occured -- similar to core dump in *nix.

Jo: There is a very simple fix to the problem -- check for an empty string

int main()
{	
	std::string myArray[] = { "January", "February", "March", "April", "May", "June", "July",
		"August", "September", "October", "November", "December", ""};

	for(const std::string* str = myArray ; *str != ""; str++ )
                     std::cout << *str << '\n';
                std::cout << '\n';
				
	std::cin.get();

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

>>for(const std::string* str = myArray ; str != 0; str++ )

Now how can that ever work because myArray is not a nulll-terminated array. You are attempting to apply C-style character array techniques to a c++ string, and won't work.

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

but I thought that there was also a way that you could use the beginning and end of the array to loop threw the array like this .

use vector<string> and you can do what you want using iterators.

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

my guess is school projects.

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

Quite frankly I have never read K&R. I looked at it briefly in a local book store, saw the size and price, then decided to buy a book that was 3 times its size and half its price. Some people live and breath K&R, but I think it is a waste of money, especially for beginniners. As for errors, almost every book has those. One would think that for the price the publishers demand for those books they would have better reviewers to catch programming errors.

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

Ohhhhh. That little boy in ~S.O.S~ picture looks like he is in soooo much trouble :mrgreen: 7 girls to 1 boy -- is that what you call a fair contest ?

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

I would think you should contact the school that you want to attend.

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

There is no one generic way to write for touch screens -- it is all hardware dependent. The only exception I can think of is wireless devices using WinCE operating system. Otherwise you have to read the touch screen manufacturer's programming reference manual.

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

I already got those notes but theyr kinda complicated

writing assembly language is always complicated. Being a tad crazy and nuts helps :lol: which is why there are not many assembly programmers left in this world, its a lot easier to just let higher-language compilers do all that grunt work.

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

learn to use google

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

Here is a link that might help you. Sending graphics to a lazer printer is not quite as simple as what Walt described, but similar -- I have not tried it myself.

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

>>void printarray(int *,int);
That is the wrong prototype because one star is a 1d array.

void printarray(int **,int);

or
void printarray(int *array[],int);

or
void printarray(int array[MAX][MAX],int);

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

>>The problem is that am not sure of how to code them, could you now help me?

No because you did not answer my previous questions. But here is some general information.

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

If its the old 16-bit Turco C++ then you can forget it because all the drivers I know of are 32-bit Windows. I don't know how to do it in *nix -- probably postscript or something like that, but that is just a guess.

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

If you google for ODBC you will find a lot of information. and this tutorial

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

what operating system and compiler ?

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

you will need to learn SQL query language and, possibly ODBC functions. google for those keywords and you will get pleanty of help and some free c++ classes. This is no small feat -- there are entire books written on those two subjects. Definitely not for begining c and c++ students, you will need at least a fundamental understanding of those languages.

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

So do you play basebal??:rolleyes:

no, just a baseball fan -- St Louis Cardinals

automobile license plate
[IMG]http://stlouis.cardinals.mlb.com/stl/images/im_licenseplate.gif[/IMG]

2006 world series winner. #2 all-time world series winner (New York Yanks are #1)
[IMG]http://mlb.mlb.com/images/2006/10/27/NVnA7NPn.jpg[/IMG]

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

Many software licenses I have read say that you do not own the soaftware but you own the right to use the software.

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

download these 101 VB examples from Microsoft

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

its nearly impossible to take a compiled executable and reconstruct the c program. how is a decompiler even supposed to know the original source was written in c, or c++, or basic, or fortran, or ... ? Also it is not possible for it to reconstruct the structures that may have been used. So I think you are wasting your time if you expect the decompiler to generate c code for you. Just not going to happen.

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

whats mountain dew?

when im working hard i have a red bull or something

Its a soda that tasts like cow urin, or rather what I think cow urin would tast like if I tasted it. I dislike the stuff.

As for Jones soda -- I never heard of it.

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

It appears the only differences are the graphics card and the size of the hard drive. The hard drive difference in price is minimal -- you can buy a 250 gig hard drive in USA for about $75.00

So that leaves just the graphics card. Do you like to play a lot of games on your computer? Many games require high-end graphics cards so you would be better off with the more expensive computer. If you do not, then the cheaper computer is for your.

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

What happens on Thanksgiving day ?

In memory of which event is this day celebrated ?

Obviously you did not read my any of my original post. If you had you would have know what this holiday is all about.

And you would have found that it is a "day of mourning" to most native american indians because it was (mostly) the white europeans who pulled the "genocide effect" on them and nearly succeeded.

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

To you mean Sage Timberline ? Sorry, never heard of it. You should probably contact their support staff.

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

what kind of database? MySql or something else?

>>and the txt file should automatically get updated whenever the log file is modified
This might require a trigger on the database. When the table is updated then a trigger will be activated to run a stored procedure that maintains the text file. This has nothing to do with c or c++, but is a database feature.

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

I agree with tgreer -- sell it or give it away to your friend. Even if it is illegal the softward police are not going to go after you because it is only a one-time deal. Now, if you are in the business of selling illegal software, that is a different story.

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

I'm not sure how to do it in C#, but in C or C++ I would format the integer as a string then test each character of the string.

What will you do when the digits are in random order? such as:
n=129438623;

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

Well, Sharky, it isn't the food you put on your table, but the spirit of being thankful for what you have and enjoying the company of loved ones that is important. Sure, turkey is traditional meal, but anything will really work as well.

That's a very good film you posted; a little old but most of it is still relevent.

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

you can't initialize arrays like that in the class definitions. Initialize it in the *.cpp file just like you would any other global array.

// *.h file
class date
{
private:
unsigned int nDay,nMonth,nYear;
static unsigned int nMonthArr[12]; //LINE 36
...


// *.cpp file
unsigned int Date::nMonthArr[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; //LINE 36
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm confused -- you said you want an interest program but you wrote a currency conversion program. which is it?

Please edit your post to use code tags as described in the link in my signature.

you might first try doing the interest part with pencil & paper. Just write down what question you want to ask and then how to calculate the interest. hint: interest = principal times interest rate. Variable can not be integers because integers to not have decimal places.

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

Thursday is the American Thanksgiving holiday. :) We adopted the annual celebration from the UK -- where they got it from is anyone's guess. It was originally a religious holiday to give thanks for good and bountiful crop harvests that year. Now, its still celebrated during the fall but the religious part has pretty much disappeared.

Thursday is also a Nation Day of Mourning for the thousands of native americans who are still alive, to honor their dead who were massacred by settling europeans and who are to this day being treated as second-class citizens. The attempted genocide of the jews during WWII is nothing compared to the almost complete genocide of the native american indians.

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

you need to contact the tool's manufactuere to find out if it supports mobile devices. From the error message I suspect not.

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

Is your program written with Visual C++ 2005 for a smart device? If it is, you can not use c++ streams because those devices do not have a console.