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

Here is a tutorial that is almost like what you are trying to do. Study this tutorial and you will probably see your problem.

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

Don't know what caused that error. My suggestion would be to uninstall that compiler (see Control Panel) then reinstall from Microsoft Website, unless you previously saved the download file on your computer.

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

that 11 is a typo but other than that I don't see why im going wrong. can you be little more detailed

if(voter >==18 && voter==registered) Look closely at this -- there is no such operator as >== Study the operators in the link you were previously given.

If you are ever going to be successful programmer you must pay great attention to detail. One small slipup can cause hours of headaches.

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

size is declared as an int on line 6 so the error you posted can not be the result of cin >> size; . Repost the code where that error occured.

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

you mean like this: int x = 0x0F; "0x" says the following characters are hexidecimal

>>is there any way for me to indicate to the compiler that all variables are in Hex
Its not necessaary. All integers can be interpreted as decimal, hecidecimal, or octal. The internal representation is the same for all three types, its only how you want to display the value that changes. For example, to display an integer X as hexidecimal, cout << hex << x;

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

line 11 of main() is definitely wrong. YOu can't use cin like that. Not sure what you need to do there other than cin >> size;

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

only 5.2 ?? Those occur almost daily in California. People there don't even stop to notice unless the quake is at least 6.0. One of these days we expect California to be like UK -- slowly drifting out to sea. I've lived in my area (about 1500 miles from California) for about 30 years and have felt an earthquake only once.

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

I didn't feel a thing. Maybe that was just the UK drifting further out to sea :)

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

That loop is just crazy. How can that loop ever execute correctly if the value of values is read from a file. You need a completly different variable when inputting the file

int i = 0;
while( in_file >> numbers[i] )
 {
      ++i;
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well I can see you have no clue what you are doing. Add this method to Matrix class

void display()
{
for(int i = 0; i < 3; i++)
{
   for(int j = 0; j < 3; j++)
   {
       cout << tomb[i][j] << " ";
   }
   cout << "\n";
}

Than call it in main() after sum has been calculated sum.display();

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

A for loop typically has 3 clauses, you've got 2.
.

In this program it is ok because the loop counter is incremented inside the loop.

but now that I look at that line some more it is all screwed up. for(input>0;counter<=limit;) sould be for(input=1;counter<=limit;++counter) then you can delete line 23

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

My guess is that you are trashing memory some place -- could be buffer overruns, out-of-bounds problem or any number of other things. One way I've used to narrow down the problem is to comment out large blocks of code until I eventually find where the program breaks. Of course the first resort is to use my compiler's debugger to inspect variable values.

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

that is stub.h ?

line 18: limit is an uninitialized variable, so it could be any old random number including 0. You need to initialize it with something if you expect that line to work properly.

line 21: you need to test if input is <= 0 and if it is break out of that loop

line 36: delete it because its outside the loop. No need to test the value of input here.

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

if(voter >=18 && voter=registered) if(voter >=18 && voter=registered) use == logical operator instead of the assignment operator =. Do the same in all the other problems too.

Car: replace ll with ||, they are not the same.

The last one isn't even close.

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

Is there another way to solve this problem instead of using files...

Of course -- just store the encrypted data in memory. But of course when your program ends to does that data :)

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

Can you duplicate the problem with a simple test program? According to the assembly code you posted it looks as if you pass the 'this' pointer to a non-class function or to a static function of a class.

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

My guess is that you are using MS-Windows and you want to compile a program written for *nix. If you install gcc or Dev-C++ you might be able to compile it ok. If you don't have one of those two compilers then your only resort is a complete rewrite of the program using MS-Windows API functions. Getting the header files is of no value without the libraries to go along with them, and libraries are often compiler dependent.

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

My eyes are not so good so I can't see the code that's on your monitor very well. Will you post it so that I can see it better?

>>but i have no counter j at all in the code...
sum is a 2d array right? Then if you don't have a j variable you have to add one.

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

>>if( Gpa >= 3.0)&&(Gpa==3.6)
Re-read the requirement and you will figure out what is wrong. if( GPA > 3.0 && GPA < 3.6) The voter one is wrong too, but I'm not going to just give you the answer. Hint: there is no return statement required.

The statement about the car: you will need three variables: int speed, bool ranredlight, and bool parked. Then test those variables as required by the statement.

The last one is probably the most difficult for you to do because you have to check if the character is between 'a' and 'z' or between 'A' and 'Z'.

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

What operating system and what compiler do you have ? Each compiler is different, so you have to be very specific about that.

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

that's the wrong test for this problem. The file pointer is only invalid, very similar to using an unitialized pointer.

>>is there any other way to test it.
Probably check the return value of fprintf(). If it failed then most likely you have the problem you are describing.

If an output error is encountered, a negative value is return

The way I got around this was to open the file before each write then close it again after the writes were finished -- this was a logging program.

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

So you want to write your own compiler ? Or are you asking how to write a program that will run on a diskless computer ?

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

>>But i don't know... I am not good at C++.
I take it then that you did not write the code you posted. Did your teacher give you that code for this assignment or did you copy (steal) it from someone else ? (rhetorical question not to be answered here).

Looks to me that all you have to do is display each of the matrix rows and columns. Create two loops with loop counters i and j then use cout to display the values cout << sum[i][j];

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

This is C code not C++.

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

you have missed a couple braces (at lines 2 and 13) and you have lines 5&6 and 10&11 backwards. (can't display something after the function returns).

also delete line 1, or make it a comment, because it does nothing.

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

That functions does not do what the comments on line 5 says. Doing a bit-wise and operation on two variables does not check to see if either of those values exist in the student class. You have to make comparisons

if( (stu.exam1 == esam1) && (stu.eam2 == exam2))
{
   return true;
}
else
{
   return false;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you have even the slightest idea of what you are doing?
line 8: performs bit-wise and operation on the two values,
line 9: toss the result set by line 8 straight into the bit bucket and set the value of r to 1.
So why don't you just delete line 8 because it's not used for anything.

If you remove all the fluf and unnecessary code, your function boils down to this:

// function example
#include <iostream>
using namespace std;

int students (int exam1, int exam2)
{
  cout << "The result is 1";
  return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Scroll up to the top of the page and click on the link Private Messages, there you will see a list of the messages you have received. Just click the links.

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

You can't do a linked list without the add, edit, and delete functions. But do a search for linked lists and you'll get hundreds of hits, such as this list here at DaniWeb

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

The problem with that insertion sort function is the the function doesn't know how many elements are in those two arrays -- could be as few as 1 or as many as can be held in an integer, which is a several million. Put a number inside those brackets so that the function will know how big those arrays are. I'm using an arbritrary number here so you would use the correct number. void insertion_sort(int numbers[255], int* array[255])

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

(ummm.... i wasn't the one having the problem with the code, i know for a fact that the code i posted works... i was posting it so sfurlow2 could see how to do it, else i wouldn't have commented it i would just have put a code snipet for all to see and copy... sorry just sayin....)

My apologies -- I misunderstood. I thought you were asking if it worked.

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

You could do that without the class just by writing out each line as they are entered, within that else statement something like you tried to do. Move things around a bit and you should have your program. I already posted more than what I should have, so you'll have to try it yourself, but don't be afraid to repost if you have more questions.

And Dave is right. but you will get to that when you study c++ classes.

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

In IE6 there was a menu File --> Open. That doesn't exist in IE7, or I can't find it. So I resort to using Windows Explorer and double-click on the *.htm file I want to load.

Anyone know how to do it like IE6 ? Or a better way (in IE7) ?

Thanks

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

You made it more complicated than it needs to be.

#include <iostream>
#include <vector>
using namespace std;

// This class hold the three numbers for one line.  
// It is saved in a <vector> so that it can be
// retrieved and printed later.
class line
{
public:
    line() { n1 = n2 = n3 = 0;}
    line( int num1, int num2, int num3 )
    {
        n1 = num1; n2 = num2; n3 = num3;
    }
    void outdata()
    {
        // print one row of the data in html table format
        int sum = n1 + n2 + n3;
        cout << "<tr><td>" << n1 << "</td>";
        cout << "<td>" << n2 << "</td>";
        cout << "<td>" << n3 << "</td>";
        cout << "<td>" << sum << "</td>\n";
    }
private:
int n1, n2, n3;
};


int main()
{
vector<line> tabledata;
//declare variables

int num1 = 0, num2 = 0, num3 = 0;
int end_sum = 0;
int lineno = 0;
//user enters a series of integers one at a time
//display negative integers in red
//when input is a 0, do not display zero and
//output empty cells for missing values in the row
//sum all columns in the last row

//html table set up

while (!end_sum) //while it is not the end of user input 
{
    cout << "Enter line number " << lineno+1 << ":  ";
    lineno++;
    cin >> num1 >> num2 >> num3;
    cin.ignore();
    cout << "\n";
    if( (num1+num2+num3) == 0)
        end_sum = 1;
    else
    {
        line ln(num1,num2,num3); …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

its installed with your compiler. search your file system for libm.a and you will find it. On *nix computers:

cd / <Enter> -- cd to root
find . -name libm.a -print <Enter>
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is no one way to accomplish what you want to do. Each program is unique. Without knowing what cars.h looks like its impossible for anyone to tell you how to use an array of car classes for the data you need.

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

Ok I see other syntax errors. Fix them up and repost after you get 0 errors and 0 warnings or ask questions about errors you don't understand how to fix. Until then there's not much more we can do for you.

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

I can't get the code you posted to compile. First is line 17. What's that supposed to be ?

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

Great looking code, but what is the problem with it?

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

First you have too many loops. You don't need that outer loop that starts on line 11. So delete lines 11 and 20.

line 14: replace number/2 with LIMIT.

put open bracket at line 15 and close at line 20.

Align the program indentions correctly so that you can see what's going on.

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

The brackets are fine. .

Apparently you didn't bother to read/understand the program. There are not enough brackets { and }.

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

I have no ideas how to do that eiher because you didn't post the code for that class or how it is instantiated. Don't ask me to read a different thread because I won't. Each thread must be self-sufficient.

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

>>ok, should more look something like this:
Did you compile and run that if there are no compile errors or warnings? That's the easiest way to find out if your code is correct or not.

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

>>howcome?
CLICK THE LINK. *Sigh*

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

>>give me a clue what to do next..
like replacing void main() with int main() ?

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

>> lazer printer
Laser printer? American spelling? But that wouldn't really make sense... :-/

You have to check the AD dictionary to find that spelling :)

twomers commented: Ah. I thought your experience may have lead to exposure to a new (or perhaps old now ;)), technology of which I was ignorant. +5
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program as posted compiles without error for me. using VC++ 2008 Express. Looks like a logic error though -- you need more brackets around that last while loop (lines 14-18).

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

All you did on line 12 is display the value of highest. You never set it to anything. Initialize the value of highest to 0 before the loop starts, then when the if condition is true set highest = x

you also need to incude <iostream> at the top of your program and add the using namespace std; statement or add std:: before each cin statement. I use the using statement because it doesn't require as much typing, but many programmers don't like that. Unless your teacher says otherwise its your call which way to do it.

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

write an == operator

class  index{

 public:
  index(string word);
 void putpage(int number);
 bool haspage(int number);
 bool operator==(index& idx); // compare the two class objects

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

when sharing memory among threads you must synchronize access so that only one thread at a time has access to the object(s). One way to do that is to create a semiphore. How to do that depends on the operating system you are using, and possibly the compiler. Do a google search for semaphore and you will probably find what you need for your os/compiler.