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

Yes that can all be done, if you have the time, experience, and talent to do it. A GUI version would require a lot of graphics coding, such as creating the bitmaps with some sort of paint program. I don't do that kind of coding so I have no idea exactly how its done. IMO you might want to join some sort of gaming forum, I'm sure they are out there if you google for them. DaniWeb has a game forum too but I don't know if the members who post thee can help you or not.

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

line 77: your class does not have a GradePoint() method. You need to add that.

If you have learned about overloaded operators yet you could also do it by overloading the > operator so that you can do this: if( xStudent > yStudent )

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

That's supposed to be the class constructor, so code it like this

Triangle::Triangle(int side1,int side2,int side3)
{

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

You need to make that a blinking sign that changes color frequently so that people will notice it. And the letters should scroll across the screen similar to scrolling banners.:)

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

>>There is a yearly membership fee of $500.00 and a monthly usage fee of $3500.00.

I would attend a different fitness club. Gold Gym only charges about $35.00/month. And the last time I checked the YMCA was $45.00/month. Why would I want to spend $3,500.00/month for that crappy health club? Do I get free drugs or sex too?

jonsca commented: Mega LOL +4
jephthah commented: aha :) +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I already told you that fin is just the name of a variable. Change it ao anything (almost) that you want.

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

Worked OK? But what?
I do not define anything!
It was just a simple example,

Sure you did

#include <iostream>

enum signum {negative = -1, positive = 1, zero = 0, inward = -1, outward = 1, indefinite = 2};

int main()
{

signum s = positive;
double x,y;
x = double(s);
y = (double)s;

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

Since you are writing managed code you will have to find out how to get the current system date/time. There are win32 api functions such as GetSystemTime(), but that is unmanaged code.

[edit]^^ posted before I saw this. Use Jonsca's suggestion.[/edit]

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

Also scroll down the page and check the box "Disable Smilies" so that all those smilies do not appear.

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

As to the original 'problem', would goto be accepted?

No -- that would just make another kind of loop.

[edit]Oops! didn't notice the sarcasm. [/edit]

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

Worked ok with my compiler (vc++ 2010 express)

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

read the file as integers not strings. Then just keep track of the maximum integer read. If you use ifstream then the >> operator will convert the number to an integer, your program won't have to do the conversion.

int number;
ifstream in("filename.txt");
while( in >> number)
{
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use any variable name you want.

Here's a short code snippet how to read a file

ifstream fin("pricelist.txt");
float price;
int itemnum;
// read all the prices in the file
// the loop will continue until 
// end-of-file is reached.
while( fin >> itemnum >> price )
{
   cout << itemnum << ' ' << price << '\n';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Call srand(time(NULL)) only once during the lifetime of your program. I normally put it near the beginning of main().

You don't replace m_QNo with 300 everywhere in your program. Only in that one function with rand().

I have no idea what that _SCL_SECURE_VALIDATE_RANG macro does.

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

So just add the full path to the filename.

str = "C:\\user\\user\\Desktop\\history\\" + str;
str += ".txt";
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Nice article. Thanks for posting it. I'd give you more rep but I can't.

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

>>So a zero-length array is okay?

Maybe yes, and maybe no, depending on the compiler. I don't know exactly how its treated because I don't have a compiler that allows it. But I suspect that its the same as passing 0 to malloc int *array = new int[0]; or int *array = (int *)malloc(0);

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

>>.Sorry AD, but you are missing the point here,

Yes, you are right. What I posted was crap.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
foo(float (*f)[3]) 
  {
     f1 = (*f)[0];
     f2 = (*f)[1];
     f3 = (*f)[2];
  }

Consider the following -- a lot less complicated and does the same thing

foo(float f[3]) 
  {
     f1 = f[0];
     f2 = f[1];
     f3 = f[2];
  }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Is that even legal?
It is if your compiler is c99 compliant. Many compilers, such as Microsoft, are not.

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

My problem is not random no generation.

Yes it is. Try it out and you will see why the generator is wrong.

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

>>Besides notations "array[5]" and "*(array+5)" are EQUAL. So it can be safe to say that when we accessing array element - we are actually doing pointer arithmetics.

Not really. array can not be incremented like a pointer, so it's not a pointer. You can't do array++; in the same function as where the array was originally declared.

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

>>i = rand() % m_QNo;

You want to use 300 there, not m_QNo.

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

Since the function is returning a pointer you have to declare the function like that. Your compiler will not compile the program the way you have it now.

If your teacher wants you to use NULL_CHAR then do it. But you won'
t find that used anywhere else, probably including other teachers.

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

Why did you define NULL_CHAR? Most people just use NULL definition that standard C header files already define. There is no point defining your own.

The function's return value shloud be char* (you need to add the star)

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

the first time i compiled and ran it, it did on the command prompt but now it saying that i have an error. The error stating that str is undeclared(first use this function)

Think about what the error message says, look at your program, and fix it. It the error message says the variable isn't declared, then change the program to declare it. Simple. Any ten-year-old should be able to handle that.

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

Thank you though, but i dont want all of it, i just do get how i put the array and the loop to get to work together.
Thank you :D

First create an array, such as int myarray[10]; . Open a file and read data into each element of the array. Something like this: but your requirements may be a little different, I don't know because I didn't bother to read all that stuff.

int myarray[10];
ifstream in("filename.txt");
for(int i = 0; i < 10 && in >> myarray[i]; i++ )
   ;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>So my question is, how do I from within the constructor verify that the length of the array is at least 3 ?

You can't, which is one big reason vectors were invented. What you might want to do is change the constructor to accept a vector so that it can validate the array's length.

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

>>The little programm should run and close another aplication

Nope. Not even close to doing that. It is starting 4 programs, not stopping them.

>>int time[arrayLength];
Rename that array because time is a function name.

>> int w = Time;
why? you don't need that extra variable in your program.

>>if((clock()/CLOCKS_PER_SEC)==Time)

why are you using clock() instead of time()? if( time(0) >= Time) You can't check if time() is equal to something because that may or may not ever occur. Check for >= instead of ==

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

>> printf("endl");

Huh?? endl is c++, not c, and its not in quotes. I think what you want is printf("\n");

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

i need a solution if anyone have plz

Then write one yourself. Take the hints already given and start coding. Nobody here is going to write your program for you.

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

Ok -- so what is your question? If this is on your final exam then that means you are at the end of your course. At that point you should already know how to read a file into arrays.

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

Just go to your CONTROL PANEL (see the link at the top of the page) and change your profile settings.

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

If you look at any standard ascii chart you will see that every character on the keyboard has a decimal value. The digits '0' through '9' have a decimal value of 48 to 57. To convert any digit to an integer all you have to do is subtract '0' (or 48) from it. So, the digit '1' when coverted will be '1' - '0', which is 49 - 48 = 1. Now to solve your problem just iterate through each character in the string and subtract '0', then add the result to the sum variable. For example sum = (sum * 10) + '1' - '0';

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

If you know nothing at all about Pascal then start learning with something simpler. Do you have a textbook for your course? If yes, then do all the exercises at the end of each chapter. They were put there for learning experience, not to just make the textbook thicker and more expensive.

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

I need your help AT ONCE plz IN C CODE ONLY

Go get stuffed. I wouldn't help you now even if I wanted to just because of your crappy attitude.

jephthah commented: damn skippy! +7
thomas_naveen commented: :-) +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The loop in the read function is incorrect. Using eof() like that will cause the last line to be read twice. Here is the standard way to code that loop

while( myfile >> a[i] )
   ++i;

>>The crazy thing is, when i give static size to the arrays, i can see the array elements but when i send them through this function,

Might be your debugger. vc++ 2008 express debugger does the same thing. But don't worry, its really ok.

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

No, I know what I mean, and I mean what I know.

char *src="eretznehederet"

And it doesn't have anything to do with the function, but rather with the idea of the OP wanting to copy the modified temp string into it.

Oh I see what you mean now. It wasn't clear in your previous post what you were talking about. I thought it was the function parameter.

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

>>#include <conio>

There is no such file. You probably mean conio.h

And what are all those notes??

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

I'm putting my Q. here instead of the c++ board because this is not a c++ question, but rather a compiler question.

I just installed vc++ 2010 express and the first difference I noticed is that Microsoft removed the Build menu and all its options. Now there is only one Build option under Debug. I miss the Clean option under the old Build menu.

That is the only difference between the two compilers that I have noticed for a Hello World console application. I know there must be others. One link told about MFC, but that isn't an option in Express.

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

char *src makes the string read-only. Any attempt to modify it will produce segmentation fault error.

I think you mean const char *src is read-only and the compiler won't let you write to it.

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

If you store the information in a file then display it later that will satisfy your teacher's request. With the array, you only have room for 30 grades. What will you do if someone want to enter 100 grades? There are several ways to handle that -- such as dynamically allocated arrays, linked lists, and files. But if you have not yet studies dynamic arrays or linked list then your only other option is to save the grades in a file so that they can be read back after all input is done and displayed like your teacher wants it.

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

How are we supposed to search for something in code snippets? I tried Site Search, selected C++ Snippets but got results in all the forums EXCEPT code snippets :icon_eek: That makes the Site Search almost unusable when searching for key words in specific forums.

And using DaniWeb Code Snippets link under Related Forum Features is nearly as useless. There should be a way to resort them alphabetically by subject or by author.

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

Yes of course it can. Most, if not all, c++ compilers can compile C code. Just name the file with *.c extension instead of *.cpp and the compiler will treat it as C.

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

Your terminology sucks -- its "reading the data file", not "importing" it. Your program is reading the data file all wrong. google for and read tutorial about "c++ file i/o".

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

You will be much better off using just winsock API functions. People tell me MFC CAsyncSocke and CSocket sucks canel water.

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

The error message says it all -- the Node class has a destructor but the implementation for it was never coded.

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

It is not necessary to use an array. There is no requirement to display the results in columns. I would save the grades in a text file then when done entering the grades read the data file and display the results.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include "vehicle.h"
#include "vehicle_imp.h"

One or both those header files define the vehicle class.

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

Post the program you have tried to write. Hint: use three integers for keyboard input -- one for hour, another for minutes, and the third for seconds.