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

I don't think that <cmath> is in std namespace:
Example with iostream (using namespace std;)

Example with cmath (doesn't have using...)


Maybe he declared another function named sqrt? Or a variable perhaps.

You are right that the functions in cmath aren't in std namespace -- they are in global namespace. The version of cmath supplied with vc++ 2008 express has all the using statements at the bottom of the file.

>>area=sqrt(s*(s-a)*(s-b)*(s-c));
I get no errors/warnings when I declare each of the variables float. So there must be something else wrong with the program.

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

Waaaaaaaaaaaaaaaaaaaa:'(

Nick Evan commented: :D hilarious! +9
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ABC News: Match-O-Matic

Mine was about half-and-half, but one more checkmark for Obama.

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

moved.

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

>>I have tried to use an SED editor, and it works ok. But I would like to have the option to have different colour in the output file

There is no such thing as color in a file. To color, or not to color is all up to the editor that is being used. In HTML you have [color=???] tags. There isn't anything like that in plain text files.

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

lol....i dont get it!!!!...what the ....really LOL.....

We don't get your post either. So there :twisted:

VernonDozier commented: Awesome! +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>How come?
Huh? What are you questioning? I gave you my opinion -- if you have code that proves otherwise then why did you ask?

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

You have quite a few syntax errors in that code. Here are the corrections. Note: I had to code dummy functions for clrscr() and gotoxy() because those two functions are nonportable and not implemented by my compiler. Just remove my version and you will be good to go.

I did get a clean compile, but didn't test it.

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

typedef struct node *nd;
typedef struct node{
		  struct node *next;
		  char telnum[15];
                  char fname[30];
                  char lname[30];
		  char address[70];
	}NODE;

int menu();
void Insert(nd *head);
void Display(nd *head);
void clrscr()
{
    system("cls");
}
void gotoxy(int x, int y)
{

}

int main()
{
	int m;
        nd head=NULL;

	do{
		clrscr();
		m=menu();
		switch(m){
		case 1: Insert(&head);
		break;
		case 2: printf("under construction");
		break;
		case 3: printf("under construction");
		break;
		case 4: Display(&head);
		break;
		case 5:
		break;
		default: {printf("Enter a number from the menu.");
		getch();}
		break;
		}
	}while(m!=5);
}

int menu()
{
	int menu;
	printf("1. Data Entry\n2. Search and Edit\n3. Search and Delete\n");
	printf("4. Display all records\n5. Exit\nchoice: ");
	scanf("%d" ,&menu);
	return menu;
}

void Insert(nd *head)
{
	int x=14,y=1;
	nd temp ,h;
	clrscr();
	temp = malloc(sizeof(NODE));
	h=*head;

       /*input*/
	printf("Last name: \n");
	gotoxy(x,y++); scanf("%s", &temp->lname);
	printf("First name: \n");
	gotoxy(x,y++); scanf("%s", &temp->fname);
	printf("Tel. Number: \n");
	gotoxy(x,y++); scanf("%s", &temp->telnum);
	printf("Address: ");
	gotoxy(x,y++); scanf("%s", &temp->address);
       
       /*insert*/
	if(h==NULL){
	temp->next = *head;
	*head=temp;
        }
	if(h!=NULL){
	while(h!=NULL){
       /*insert beginning*/
	if(strcmpi(h->lname,temp->lname)>0){
	temp->next=h;
	*head=temp;
	break;
	}
       /*insert middle*/
if(strcmpi(h->lname,temp->lname)<0 && strcmpi(h->next->lname,temp->lname)>0){
	temp->next=h->next;
	h->next=temp;
	break;
	}
       /*insert end*/
	if(strcmpi(h->lname,temp->lname)<0 && h->next==NULL){
	temp->next=NULL;
	h->next=temp;
	break;
	}
	else
	h=h->next;

	}
    }
}

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

Dumbass Bush

Dumbass democrats in congress for ignoring his warnings.

Aia commented: And we are the smartass that will pay for it. +9
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) you need to create another thread that processes all keyboard input events. But that means you can't use such functions as scanf() in the main program. So it boils down to this: "Don't try that without parental supervision." :)

2) Don't use the <Enter> key between numbers, hit the <Space> bar instead. You have no control over how scanf() behaves. If you want different behavior than you need to write your own version of scanf().

3) The '\b' escape character will cause a backspace. So just printf("\b") should do it, but then the cursor is probably on another line so backspace may not work. And there is no portable way to move the cursor up or down.

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

You can not use those header files with that 16-bit compiler. They require newer compilers, such as Dev-C++, Code::Blocks, or VC++ 2008 Express.

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

almost done with the batch file question. If I make a command line interface to a software program where a file contains commands for that program to execute, would you call that file a batch file?

For the millionth time: batch files are interpreted by the operating system. If the file is something your program is going to interpret then it isn't a batch file, although it can have *.bat file extension.

Get the terminology straight: Application programs do not process batch files, only the operating system shell does that. Whether its pass as a normal argument to the program or redirected doesn't matter -- its still not called a batch file.

If you are going to write your own shell that will replace the Windows cmd.exe, then yes you can call it a batch file. But I doubt that is what you intend to do because then you can't redirect to stdin nor pass as a parameter -- shells just don't work that way.

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

I saw a few sand paintings when I was in the UK during 1970s. Awesome :)

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

Its a built-in data type so you don't have to define it anywhere. The sizeof(__int8) is 1, so its the same as a char.

#include <iostream>
using namespace std;

int main()
{
    cout << "sizeof(__int8) = " << sizeof(__int8) << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you try google?

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

I've never been to a VA hospital, so don't know. But I've never heard anything good about them from people who have been there. I go to normal doctors and use tricare military health plan.

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

First you have to decide which computer language you want to learn. There are several languages that you can use to write application programs. If you want to write GUI programs than probably VB.NET is good to start -- you can download a free compiler from Microsoft.

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

>>please help me...if anybody is having any idea

Help you do what exactly? I didn't see a question in your post.

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

>>I'm also not clear as to the naming of an input file as a 'batch' file. Is that name specific to input files for OS command line interfaces only?

No. The way you want to use them they are not batch files at all but just normal every-day text files. So you can name it anything you wish. If you want the operating system's command processing handling to process the file then it must have *.bat extension.

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

Link

If you use C's strcmp() function it will return an integer > 0 if string1 is lexicographically larger than string2. Example: "Z" is greater than "A" because A comes first in the English alphabet and Z comes last. Example2: "A" less than "Z" so strcmp() will return some number < 0, and third example "A" == "A" so strcmp() will return 0.

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

Homework???? What have you done to do this problem?

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

link and see wait4(). I haven't used these in over 20 years, so you will have to test them out to see how they work.

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

check your man pages for spawn family of functions.

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

You have to use win32 api console functions.. And check out the console object here for example code

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

strcat() appends one string to the end of the other string. Before that will work you have to insure the destination string is big enough to hold both strings.

str3 is not needed, so just get rid of it.

The second problem with your program is that string literals can not be changed because they normally reside in read-only memory.

To correct the able problems

include<stdio.h>
#include<string.h>
int main()
{
char str1[126] ="United";
char *str2="front";
strcat(str1,str2);
printf("\n%s",str1);
return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Can anyone add some codes in my program so that it could output a receipt which would display the name of the items bought with their price..:)

Yes, but I won't. If you wrote all that then you should be able to write the receipt code too.

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

should have been bstrVal

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

See the spelling in the error message -- you spelled it wrong. For the header file, just include windows.h or see MSDN

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

Here is how to allocate a BSTR. There are a few variations of SysAllocString() -- use the one that suits the purpose of your program.

VARIANT vt;
VariantInit(&vt); // initialize the variant
vt.vt = VT_BSTR; // set to BSTR string
vt.bstr_val = SysAllocString(_TEXT("Hello World"));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb Liz. There are quite a few people here your age and older, so you will fit right in :)

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

try this:

char UnsortedList::DeleteFirst()
{
   char ch;
   UnsortedListNode* tempPtr = headPtr;
   
   tempPtr = headPtr;
   ch = tempPtr->ch;
   headPtr = headPtr->nextPtr;
   num--;
   delete tempPtr;
   return ch;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can write an assembler in most any language.

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

I assume the first parameter is a pointer to the head of the original list, and the second parameter is a reference to the pointer of the new list. If that is true, then do something like this:

NOTE: I did not compile or test this, so don't be supprised it it contains one or more bugs. This will give you a general idea how to go about making a copy of the linked list.

Node* newnode;
Node* tail = NULL;
while( list )
{
    newnode = new Node;
    // what is data?  just a character pointer to a string? If yes, then this will work
    newnode->data = new char[strlen(list->data) + 1];
    strcpy(newnode->data,list->data);
    newnode->number = list->number;

    newnode->next = NULL;
    // now add newnode to listCopy
    if( *listCopy == NULL)
    {
          // empty list
          listCopy = newnode;    
          tail = newnode;
    }
    else
    {
         // not empty list, so add new node at tail
         tail->next = newnode;
        tail = newnode;
   }
   list = list->next; 
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well, it appears this is as far as it will go. It is being canceled.

Best news I've heard all week :)

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

>How would I add "C:\\" to the front of the_date. strftime(the_date, 12, "c:\\%d_%m_%Y", gmtime(&now));

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

If this is a list of your own making then you have to iterate each node in the original list, allocate memory for a new node and attach the new node to the new list. Sorry but there is not much more to tell you without the details of the nodes (the structure that represents each node)

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

Yes, you can write your own compiler and assembler if you want to. Many students have done that, and so have many companies. There are college courses in compiler design that you might want to take.

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

The compiler creates a program in several steps before generating the *.exe file. How exactly that is accomplished is different for each compiler.

>>If it is binary I have always wondered how it is structured
Depends on the compiler. See this wikipedia article

>>is it possibly to actually write to machine code using fstream or w.e.
Yes, but it would be very tedious and error prone. That is best left up to a compiler.

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

>>Linker error] undefined reference to `Delivery(book*, int&)'
That error message means you failed to write the function named Delivery.

Will I write it for you? Answer: no. But give a try and come back with any questions you may have.

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

Welcome to DaniWeb. Your English looks great, better than many people whose mother toung is English. :)

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

post the structure or class Partita. We have no clue what you are talking about without that information.

If that structure contains pointers, then you have to write out their values separately, and you will have to design the file format in such a way that the Partita structure and values of all pointers can be read back.

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

between lines 45 and 46 add a line: cin.get(); to make the program stop before exiting.

delete line 1 -- stdio.h -- its not needed in your program.

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

>> im not too sure what push_back does though
Did you bother to look it up? When you don't know what something does then you need to do some research and read abo9ut it.

You have to include the header file <vector>
lines 12-18: declare structures outside all functions. Move that up above main();

line 20: delete that line because vector is the name of a c++ class.

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

use vector

#include <vector>
...
int main()
{
    vector<Thing> things;
    Thing oneThing;
    // add OneThing to the vector
    vector.push_back(theThing);

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
struct Object *delete(struct Object *start, int num)
{
      int i = 1;

counting in C and C++ always starts with 0, not 1.

I didn't get seg fault

The 7-th number in the list NUMBERS is '2'.
Deleted 10th element in list IDS.
Inserted 7-th element of NUMBERS into 10th index in list IDS.

IDS linked list:
I, 7, include
I, 5, stdio
I, 1, h
I, 7, include
I, 6, stdlib
I, 1, h
I, 6, define
I, 3, XYZ
I, 3, int
N, 1, 2
I, 4, main
I, 4, argc
I, 4, char
I, 4, argv
I, 3, int
I, 1, i
I, 1, j
I, 1, k
I, 3, int
I, 6, array1
I, 6, array2
I, 4, FILE
I, 5, Input
I, 5, fopen
I, 4, argv
I, 2, rb
I, 4, FILE
I, 6, Output
I, 5, fopen
I, 4, argv
I, 1, w
I, 3, int
I, 4, temp
I, 3, Int
I, 5, count
I, 3, int
I, 4, temp
I, 5, Array
I, 4, MaxL
I, 4, char
I, 3, str
I, 2, if
I, 5, Input
I, 4, NULL
I, 5, while
I, 4, feof
I, 5, Input
I, 6, fscanf
I, 5, Input
I, 1, d
I, 4, temp
I, 3, Int
I, 4, temp
I, 5, Array
I, 1, i
I, 4, temp
I, 3, Int

The 3-rd separator in the list SEPS is '<'.
Deleted 5th element in list NUMBERS.
Inserted 3-rd element of …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
int main()
{
    vector<nums> theList;
    nums data;
    ifstream in("filename.txt");
    while( in >> data.stations >> data.lbs1 >> data.lbs2 >> data.lbs3 )
    {
           theList.push_back(data);
    }

    // now you have an array of those structures.
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read about namespaces here and here.

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

Visual Studio 2008 Professional Version. You can't download it from anywhere but you can buy it from lots of places.

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

and also recognizes all who have become citizens due to either coming of age or naturalization.

Am I missing something? Natural born Americans become citizens the minute they are born. There is no minimum age requirements to be a citizen. Even if the parents remove the child from USA the kid is still a life-long citizen unless he/she decides otherwise.

Click here.