I do all the time. You will only cut yourself if you are being stupid.
See -- you just proved my point :)
I do all the time. You will only cut yourself if you are being stupid.
See -- you just proved my point :)
The best thing to do is just to grab every chick's ass as you walk by.. )
Yea -- that's a great way to get your face slapped or, if she's been working out, get your ass kicked to hell. And I wouldn't suggest doing that if she's walking with her BF. because you might just wind up in the hospital :)
Bless. Jamaica likkle but wi people reach all corners of the globe (and the net). Glad fi know seh wi deh yah to!
Glad you are here, but you must know that we don't take kindly to people who use chat room talk because there are people here from all over the globe that had a lot of problems understanding what you wrote. So please write out those words in normal English.
IMHO Open Office is a sweet, suite alternative to MS Office; it'll handle the microsoft file formats, it's only a little over 100MB download and it's free.
And its free too. But MS Office has a lot of features that are not present in Open Office.
I thought mods could alter user-names as well, ah well, bennet telling me lies again :P
I don't think even Dani would or could do that because it would cause a lot of problems with all the threads the poster might have made using the original name. Easier to just sign up with a different name and not use the original one.
Welcome to DaniWeb. Hope to see you around often.
Welcome to DaniWeb. I'm sure your expert assistance will be appreciated in the Web Development board.
handles up to make them easier and safer to remove. No one in his/her right mind would insert knives with the handles down.
>>ya i tried using rewind but that didnt help
Then you didn't do it right. If you are using fstreams then you also have to call the clear() method to clear the error (eof) condition flag.
Also why the else statement (line 46-49). It works fine without it.
I just didn't take it out of your original post. just delete them if they aren't needed.
I got married at 19, so I can't give any advice :) Only had one GF and I married her (she was 18 at the time). And we've traveled the world together these past 46 years. But that was me in 1962. Today, you need more education so at 19 you can't get too involved. JB is going to do just great.
>>I mean why not void main() after all it dosen't return any int value it returns void value.
main() always returns a value whether you specify one or not. int main() and int main(int argc, char* argv[]) are the only two valid ways to declare it.
int main()
{
FILE *f1, *f2;
f1 = fopen("\\tmp\\mel.txt","r");
if(f1 == NULL)
return 1;
f2 = fopen("tmp.txt","w");
char cbuff[255]= {0};
char c1[80] = {0};
char c2[80] = {0};
char c3[80] = {0};
char c4[80] = {0};
char c5[80] = {0};
int start = 0;
while(fgets (cbuff, 80, f1)!= NULL)
{
if(!start)
{
if( strcmp(cbuff,"@<TRIPOS>BOND\n") == 0)
{
start = 1;
}
fputs(cbuff, f2);
}
else
{
if( cbuff[0] == '\n')
{
start = 0;
fputs(cbuff, f2);
}
else
{
if ( (isdigit(cbuff[5])) && (isdigit(cbuff[11])) && (isdigit(cbuff[17])) )
{
strncpy (c1, cbuff+1, 5);
c1[5] = '\0';
strncpy (c2, cbuff+7, 5);
c2[5] = '\0';
strncpy (c3, cbuff+13, 5);
c3[5] = '\0';
strncpy (c4, cbuff+21, 2);
c4[2] = '\0';
fprintf(f2,"%s%s%s%s\n", c1, c2, c3, c4);
}
else
{
fputs(cbuff, f2);
}
}
}
}
fclose(f1);
fclose(f2);
return 0;
}
produces this output
@<TRIPOS>MOLECULE
C00071
7 6 0 0 0
SMALL
NO_CHARGES
@<TRIPOS>ATOM
1 O1 29.3456 6.3882 17.8044 O.3 1 <1> 0.0000
2 C2 30.4396 5.7640 17.3918 C.2 1 <1> 0.0000
3 C3 31.6613 6.2938 17.6193 C.2 1 <1> 0.0000
4 H4 29.4168 7.2248 18.2697 H 1 <1> 0.0000
5 H5 30.3544 4.8318 16.8736 H 1 <1> 0.0000
6 H6 31.7523 7.2258 18.1371 H 1 <1> 0.0000
7 H7 32.5379 5.7814 17.2819 H 1 <1> 0.0000
@<TRIPOS>BOND
1 1 2 1
2 1 4 1
3 2 3 2
4 2 5 1
5 3 6 1
6 3 7 1
@<TRIPOS>MOLECULE
C00074
15 14 0 0 0
SMALL
NO_CHARGES
I think the problem is that your function is not checking the line lengths before attempting to check character position 17 -- many of those lines are'nt 17 or more charcters long while others are much longer.
you mean like this???
int main()
{
#include <string>
That's not the way its done. put the headers at the top of the file so that they are global to everything in the file.
>>why int main() ??
every c++ program has a main function, its required by the ISO standards. If you don't know that then you are just wasting your and my time with this thread. Go to bed and get some sleep, then things will be clearer tomarrow.
PLz solve this prog. then both my functions will be over.
Itz 12:35 AM in In India..... and I also have to study for chemistry.
Sorry, but my task is to just help you solve YOUR problem. What time it is in India is not my problem. I think with the help I've given you in my previous post you should be able to solve the program yourself. The trick is the setw() function to adjust the spacing.
>>It demands header for end(), cout, endl;
See the header files in my post. All those are in <iostream>.
As for the text placement, you still use setw() function.
int nSpaces = 23;
int i = 0; // a loop counter
cout << setw(0) << list[i] << setw(nSpaces) << "price\n";
you will probably have to adjust variable nSpaces on each line to accommodate different string lengths.
Do you mean you want to print the menu text to start somewhere other than at the left side of the screen ? The you need to use setw() function found in <iomanip>
#include <iomanip>
#include <string>
#include <iostream>
// other includes here
using namespace std;
int main()
{
// Center the text with screen width of 80 columns
std::string text = "some menu item";
int center = (80 - text.length())/2;
.. now diaplsy it
cout << setw( center - (text.length()/2)) << text << "\n";
}
produces this output
some menu item
Press any key to continue . . .
I used VC++ 2008 Express and your program worked ok for me. Are you closing the two files asap to prevent the output file from being updated after the code you posted finished? Or maybe the buffers c1 ... c5 aren't large enough.
1 1 2 1
2 1 4 1
3 2 3 2
4 2 5 1
5 3 6 1
6 3 7 1
int main()
{
FILE *f1, *f2;
f1 = fopen("\\tmp\\mel.txt","r");
if(f1 == NULL)
return 1;
f2 = fopen("tmp.txt","w");
char cbuff[255]= {0};
char c1[80] = {0};
char c2[80] = {0};
char c3[80] = {0};
char c4[80] = {0};
char c5[80] = {0};
while(fgets (cbuff, 80, f1)!= NULL)
{
if ( (isdigit(cbuff[5])) && (isdigit(cbuff[11])) && (isdigit(cbuff[17])) )
{
strncpy (c1, cbuff+1, 5);
c1[5] = '\0';
strncpy (c2, cbuff+7, 5);
c2[5] = '\0';
strncpy (c3, cbuff+13, 5);
c3[5] = '\0';
strncpy (c4, cbuff+21, 2);
c4[2] = '\0';
fprintf(f2,"%s%s%s%s\n", c1, c2, c3, c4);
}
else
{
fputs(cbuff, f2);
}
}
fclose(f1);
fclose(f2);
return 0;
}
First you have to learn how to read :) See the Read Me threads at the beginning of this board.
If you initialize that array with 0s when it is declared then just check if the first character is 0.
for(i=0; list[i][0] != '\0'; i++)<<--------------------- problem
{
worked for me using VC++ 2008 Express. What compiler and os did you use?
>>void Menu (char list[5][20], float price[5])
Do you mean the number of rows in the above function? If yes, the answer is 5. If not then I don't know what you are talking about.
How can I underline a text ??
cout<<"Hungry Kya ??"
output needs to be
Hungry Kya ??Also is there a predefined function to get the numbers of rows of a 2D array ??
not possible with MS-Windows and your compier. Years ago with MS-DOS 6.X it could be done, but that's not supported any more. To do it today you have to use win32 api console functions, but you can't do that with your compiler.
>>Yes I am using Tc++ v3.0 I suppose
suppose isn't good enough.
You could use getche() but it is even more clumsy because it requires a loop.
The Input you posted doesn't make sense with the code you posted. The first line after the fgets() is checking characters positions a lot longer then the example input lines you posted.
My guess is that the function you posted is not causing the problem.
at 14 Im trying to enter the string to be stored in array po[].
Your age has nothing to do with the problem. use strcpy() to copy one string to another strcpy( po, "pizzaboy" );
, assuming po is a character array large enough to hold the string.
>>they should be compiled separately and linked together with the linker.
both the fuctions are compiled seperatly !!
How do I link them with the main prog. is my porblem.
Depends on the compiler. Looks like you might be using Turbo C++, is that right? If it is, then just add each *.cpp file to the project separately and the IDE will link them correctly. That is just a matter of learning how to use your compiler.
BTW: please re-read my previous post because I added some more comments.
>>#include"FUNCTION.cpp"
NEVER EVER do that. When there are two or more *.cpp or *.c files then they should be compiled separately and linked together with the linker.
>> gets(ur);
NEVER EVER for any reason use gets() function because it can crash your program by copying more characters from the keyboard buffer into the input buffer (ur in the above case) than the input buffer can hold. That is called buffer overrun and gets() will just scribble all over memory. To correct this, use fgets() instead, like this: fgets(ur, sizeof(ur), stdin);
fgets() too has a small problem: it appends the '\n' (the Enter key) to the end of the string, so your program has to strip it off. That's one big reason not to use C functions in a c++ function because the C++ iostream class doesn't do that.
fgets(ur, sizeof(ur), stdin);
if( ur[strlen(ur)-1] == '\n')
ur[strlen(ur)-1] = 0;
One of your big big problems is code style -- it is absolutely horrible. Here is an example of a better coding style and is a lot easier to read.
int password(char usr_name[], char pwd[])
{
int j=0,k=0,i=0,m=0,n=0;
char corr[9],po[7];
corr[8] = "pizzaboy";
for(i=0;usr_name[i]!='\0';i++)
{
if (usr_name[i]== corr[i])
n=1;
else
n=0;
}
po[] == "qwerty";
for(j=0;pwd[j]!='\0';j++)
{
if (pwd[j]== po[j])
m=1;
else
m=0;
}
if (m==1 && n==1)
k=1;
else
k=0;
return (k);
}
Notice that line 14 of the above code is an error. I don't know what you are attempting to do there.
Ok, so I'll stop this thread then.
Is that all there was of the assignment :-O It doesn't contain any instructions, just a few tables. I'll bet you didn't post everything that you were given.
can't help you until you post your code.
Dev-C++ doesn't produce the errors that VC++ 2008 Express does. The problem with the program is that line 79 is printing the return value of clock.OurTimeIs(), but that function isn't returning anything, so the return value is just some random number. Dev-C++ should have produced a warning or error about that, but it didn't.
this billing function is still undone.... I am still working out the password function.Then again will try the menu fuction.
Anywayz thanx for the help. Close this thread plz. coz the menu fuction seems impossible.
You giving up so soon? The function isn't impossible, you just haven't found the right solution. When you get really frustrated then its time to just leave it alone for a day or so then you can come back to the problem with a fresh mind.
Oh, I get it now. I apparently completly misunderstood the question.
thanx trying btw itz not dots they were spaces.
Then just delete the fill() line that I posted.
char corr[8] = "pizzaboy"
it still giving syntax error:confused:
post new code please. And this time post the entire function, you left off the last few lines in your original post.
Maybe yes, and maybe no. Here is a console function that seems to let you change the font, but I haven't used it so you will just have to experiement with it.
OurTimeIs() has the parameters for the desired hours, minutes, and seconds. So why is it resetting those times to those of the class? What good are the parameters then? If that's what you want, then delete the parameters and use the class time variables directly. If not, then delete lines 62, 63 and 64.
line 12 and 83: produces a compile error. I compiled your program with VC++ 2008 Express. This is probably the cause of your problem -- you must have just ignored this error.
what exactly do you mean by that? what operating system? what kind of printer ? what font? any graphics? any lines? If you search www.codeproject.com you will find a few c++ classes for laser printers that do all sorts of fancy things in MS-Windows.
line 235 (as posted here): left is not a function or a function pointer so you have to remove the parentheses postOrderTraversal(subRoot->left);
why can't the calling function check to see if there are more last names with the same value?
int index = searchLN( <parameters here > );
while( inName[index].getlastname() == targetLastName)
{
cout << inName[index].getlastname() << " ";
index++;
}
Interesting reading and a unique way of presenting a problem, but I'm still not going to do your homework for you.
you mean your username elete1986 ?
the only c++/CLI compiler (that generates CIL which could run on many platforms) is the one from microsoft. other CLI implementations (like mono) do not provide c++ compiler support.
I think some Borland compilers will do that too.
Question: where do threads go when they die? Is there a thread heaven ?
would some moderator just close this thread? maybe that way somebody else doesn't come and restarts the war in here... :D
It doesn't violate any DaniWeb rules so there is not reason to close it.
There is no one best answer to that question, and every program will be a little different. I would normally put each class in its own header and implementation files, but depending on the size of the class that may not be always necessary either. For non-class functions dividing them up into separate smaller files is somewhat abritrary.
I am on windows.
Which is the compiler most widely used in the industry ?
For MS-Windows, Microsoft compilers are naturally the most widely used by professional programmers because, for one reason, MS-Windows was written by Microsoft compilers. Here is one testimonial to that statement. Professionals rarly use the Express version, which is intended for learning. The Professional version is probably the most popular versions of Visual Studio 2008 series.
>>I hope you've either found it interesting, or you're getting paid to do this.
Interesting, yes. Getting paid, no.
>>there are clearly several ways to skin this cat
For those who don't know, skin a cat doesn't mean an animal. A cat refers to a Catapiller heavy duty dirt moving equipment. My dad did that for about 50 years and I heard that phrase thousands of times. Catapiller is a brand name of the equipment.
I believe that moderators can do this.
No we can't -- I just tried it and it doesn't work.