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

If she was good loking then noone would think she was special. Why doeas a ugly person with a talent get so much attention?

Who said she is ugly? Beauty is in the eye of the beholder. There are been several similar stars -- such as Jim Nabors who played the sitcom character Gomer Pile in 1969.

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

You should read the forum rules before posting, otherwise you will probably get into trouble. This is a feedback forum, as the title of the forum suggests. You will find rules specific to each forum at the top of the forum, like this:

Our Community Feedback forum is the place for DaniWeb site announcements, comments, and feedback..

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

Sane on PFO posts monthly challenges. You could join in there with your own challenges.

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

>>I thought the discussion forum was for suggestions.
It is -- but you didn't post a suggestion. Geek's Lounge is where you can post silly and/or off-topic stuff. About the only time you will get kicked off there is if you post technical support questions, profanity, porn, advertisements, or flame someone.

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

continue program exception in the catch block.

void foo()
{
    cout << "foo() is throwing an excetption\n";
    throw 1;
}

int main()
{
    try
    {
        foo();
    }
    catch(...)
    {
        cout << "Exception caught\n";
    }
    cout << "Ending program\n";
}

Output is this:

foo() is throwing an excetption
Exception caught
Ending program
Press any key to continue . . .

[edit]And what ^^^ said. He beat me to it. Oh well, that happens sometimes.[/edit]

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

Any extra work is strictly optional, for your own benefit, and will not directly affect your grade

Bummer!:(

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

You can execute another program on PPC the same way you do it on a PC. CreateProcess() win32 api is one way. Remember, PPC does NOT have a command prompt, so system() is not available (as I recall). There is also no such concept as current working directory or change directory. There are directories on PPC, but there is no way to change the current working directory of the program.

Also be careful where you put files. If you have to cold boot the ppc device the file system gets reinitialized to the manufacturer's default. Files stored on extra memory device are unaffected by cold boot.

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

I would have done it slightly different what what William posted -- initialize the value of num with the first element of the array on line 10, then line 21 of his code could be deleted.

William Hemsworth commented: Good idea. +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

learn win32 for a PC first because its a lot easier to debug. There are lots of tutorials, such as this one.

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

its almost identical to XP. There are some differences but you will learn them as you go an read the MSDN articles about the functions. If you know win32 on XP then doing the same on a smart device is not difficult.

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

I only have the Express edition which doesn't have that option. But I did worked with pro edition of 2005 compiler and that is the option needed to start a project for the wireless devices I was talking to. In addition to the compiler you have to get Device Driver SDK from the manufacturer of the hardware, such as from Symbols Technologies, Intermect Inc., etc. The 2005 compiler came with a smart device emulator while will let you get started coding for the os in general terms, but the emulator has very limited capabilities. There are lots of things the emulator can't do because they require physical hardware.

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

The bin file might be smaller than the text file because each integer written in binary mode only requires 4 bytes of file space (sizeof(int)) or 6 bytes for a float sizeof(float), while the same integer in a text file will require one byte per digit plus spaces between numbers and line terminating characters '\n'. The only way to predict the size of the binary file is to count up the size of all the integers, floats and doubles.

It might be interesting if you would zip of the text file and post it so that we had something more concrete to work with.

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

you mean a wireless device such as a cell phone or barcode scanner? I would imagine it would depend on the compiler and the device type. I've done programming with Mobile 5.0 and Pocket PC operating systems on a barcode scanner (Symbols and Intermec) Those two scanners have completely different programming API even though they are running the same os.

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

I didn't get any errors compililing those headers with VC++ 6.0

#include "stdafx.h"
#include "iostream"
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
inline void keep_window_open() {char ch; cin>>ch; }

int main(int argc, char* argv[])
{
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I know budy its sooooooo difficult but it is very interesting. Think about it and also discuss with your friend and teachers and if you find any solution please tell me.
Thanks

Didn't you even bother to read any of those links? One of them is even a tutorial. If you don't understand that tutorial and the code examples it contains, then there is probably little, if anything, we can do for you.

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

how do you know it does not convert the entire file? Did you write another program to read back all that binary data and compare it with the original file?

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

MAC vc PC Click the Elimination link

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

its too complicated for you yet. Its something that can not be done easily in c++ -- VB is actually a better and easier language for graphics, but that's not the course you are taking.

Here is a tutorial if you want to get your feet wet.

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

yes, a triangle could be displayed like this:

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

That compiler can build GUI programs in which you can draw circles, rectangles, and other graphic shapes. Does your teacher expect graphic shapes or text shapes ? Are you in a first year programming class ? If yes, then I suspect your teacher only expects text shapes because graphic shapes are more advanced topic.

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

Do you also manufacture your own automobile? Grow your own food? Milk your own cow? Build your own house? You didn't write wcslen() so why be so inconsistent. When you write all that yourself you just have lots more code that introduces bugs you have to fix, like this one.

iamthwee commented: 'Milk your own cow' - don't EVER call her that, she'll slap you. +21
tux4life commented: Excellent! +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you will have to post bintree.h if you want anyone to compile and test your code.

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

line 6 is unnecessary.

you are not null-terminating the destination string. wcslen() returns the number of characters in the string and does not include the null terminator. So add a line after line 10 to null terminate the destination string.

You could also have just used wcscpy() and not bother with all the hassle of rolling your own copy function.

DarthPJB commented: great understand of the problem and solution +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Interesting, even people who believe don't agree with each other.

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

Small update -- that youtube now has over 100 Million hits! I just listened to it again as well as the song she sang in the semi-finals. Now she's off to the finals and most likely will win it also.

I'm going to be one of the first people to buy her album when it's released, and I hope its sooner rather than later. I hope that dear lady gets everything she deserves.

I do find it strange that the newspapers in UK keep referring to her as a virgin :) Do they think she's the Virgin Mary or something?

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

Not to worry. Been there and done that. It often helps to have another pair of eyes look at a program.

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

your program crashes because line 3 is a pointer that is not allocated. Remove the stars on lines 3, 15 aned 17.

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

If you don't care which record is being read, then just do seekp() to the desired record number and read it.

Otherwise, if you want a specific record then you need to sort the file so that it is in sequential order. Then you could do a binary search algorithm to find the specific record. Since the file is quite small, just read the entire file into an array, discarding the unused records. Then sort the array, and search it. But that is a lot of work for such a small file.

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

>>it sorts but then just quits out of the program for no reason..
Nope. It quits because there are problems with the code you wrote. Please post the code so that we can help you.

The basic idea of sorting structures is the same as sorting an array of integers. The only difference is swapping structures instead of integers.

struct person temp = p[i];
p[i] = p[j];
p[j] = temp;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>how can I read that binary file randomely
Can't do it. Text files can only be read sequentially because of the variable-length records. And that input file (in.data) is a text file, not a binary file.

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

Welcome to DaniWeb. With all your experience I suspect you will be a big asset for helping others.

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

you have a few problems with that class. I just put all the files into one *.cpp file because I was too lazy to use separate files as you posted them.

The main problem was in the readBinary() function. Using the sample data you posted I got the same output that you expected.

#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

const int MIN_ID = 11;
const int MAX_ID = 99;
const float MIN_GPA = 0.00;
const float MAX_GPA = 4.00;

class StudBinaryFile
{
 public:
     StudBinaryFile() { id = 0; gpa = 0; }

 void setId(int idVal);
 
 void setGpa(float gpaVal);

 void ReadRd(int i,ifstream& inFile);

 bool validRd();
 
 void writeBinary(ofstream& outFile);

 void writeInvalidRd(ofstream& outFile2);

 void readBinary(ifstream& inFile, ofstream&    outFile2);
 
 void printData(int count, ofstream&  outFile2);
 
private:
   int id;
   float gpa;
};


void StudBinaryFile::setId(int idVal)
{
	id = idVal;
}

void StudBinaryFile::setGpa(float gpaVal)
{
	gpa = gpaVal;
}

void StudBinaryFile::ReadRd(int i, ifstream& inFile)
{
	id = i;
	inFile >> gpa;
}


bool StudBinaryFile::validRd() 
{
	 return ((id >= MIN_ID)&&
                (id <= MAX_ID)&&
                (gpa >= MIN_GPA)&&
                (gpa <= MAX_GPA));

}

void StudBinaryFile::writeBinary(ofstream& outFile)
{
	outFile.seekp((id % 29) * sizeof(StudBinaryFile));
	{outFile.write(reinterpret_cast<const char *> (this), sizeof(StudBinaryFile));}
}

void StudBinaryFile::readBinary(ifstream& inFile, ofstream& outFile2)
{
	int count = 0;
	inFile.read(reinterpret_cast<char *> (this), sizeof(StudBinaryFile));
	while(inFile)
	{
	    printData(count,  outFile2);
		count++;
		inFile.read(reinterpret_cast<char *> (this), sizeof(StudBinaryFile));		
	}
} 

void StudBinaryFile::writeInvalidRd(ofstream& outFile2)
{
	outFile2 << id << setw(12) << gpa << endl;
}

void StudBinaryFile::printData(int count,ofstream& outFile2)
{
	if(id != 0)
		outFile2 << count << ".)  "  << id << setw(12) << …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

code tags really help :)

Didn't help a bit.

or it's really simple to run through that loop in your head... and if you understand what's going on it's even easier to know what the answer is without having to go through the whole loop.

Agree -- only the final iteration of the i loop is relevant.

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

you can't do that. But what you can do is have a vector of vectors, just like a 2d array of doubles

vector<double> columns;
vector<columns> rows;

Now each row is like your vector_0, vector_1, etc.

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

k does not loop at all. Its only an integer that sums up the values of j in the last iteration of that i loop. So the final value of k should be 3 + 0 + 1 + 2 + 3 = 9.

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

Since you didn't care to express your opinion in a decent post, allow me to copy it for you, so I can make a reference to it.

What do you mean by "I rarely give bad rep except here"?
What prompts you to give a bad rep here?
Why is important for you to make a distinction between "here" and "over there", I suppose?

What's the result or effect you expect to achieve by giving a bad rep here?
And lastly, if you don't mind; why do you choose such a very limited form of expression to show disapproval, when it is so prompted to misunderstanding and there's not provision for rebuttal nor dialog?

Rep here in Geeks' Lounge means nothing at all, it doesn't affect your overall rep points. All it does is put a yellow or green dot on the post. Those of us who have high rep counts need to be a lot more judicious about when to give bad rep (in the other forums) because we could easily destroy someone's rep count which would be very difficult for him to recover. Anywhere except here in the Community Center I will normally make a post explaining my disagreement instead of giving bad rep. I'm a little more liberal with giving out good rep when the member deserves it.

To be honest the only reason I gave you bad rep in this thread because you were complaining about the rep system. Had you complained …

iamthwee commented: Amen +20
tux4life commented: Good clarification about the rep system :) +8
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Great idea, but I haven't the slightest idea how to do it.

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

Here

Don't expect to learn how to use that compiler in just a few minutes. Creating a project is quite simple, just following the File --> New menu.

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

I see what you mean. The Enter key remains in the keyboard buffer after scanf(), so you need to flush it out. Here is one way to do it, just call scanf() again with a different variable.

int main()
{
    char op, c;
do{
	printf("\n");
	printf(" A : Quadrado\n ");
	printf("B : Rectangulo \n");
	printf(" C : Circulo\n");
	printf(" D : Triangulo\n");
	printf(" E : Trapezio\n");
	printf(" Indique a opcao : ");
	scanf("%c",&op);
	scanf("%c",&c);

    op = toupper(op);
  //  cin.ignore(256);
//	printf(" Opcao Invalida \a");
	
} while( op < 'A' || op > 'E');

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

oh!! then does this problem arise because of the problem in allocating the required amount of memory by the compiler ?

Its not a problem. The C language was designed like that some 35+ years ago (officially 1972).

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

vc++ is the name of a Microsoft compiler, not a computer language. Is that what you meant?

How to practice using the compiler: Just use it for some projects you can find anywhere on the net, including right here at DaniWeb.
In addition to knowing how to create projects, you will probably need to know how to modify project properties and use debugging facility (set/clear breakpoints, step into and out of functions, display value of variables during execution, etc.).

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

thanks for your response. but can u please tell me why executable statements cant be given before variable declaration ?

Yes -- because the iso standards say so. I have read that this requirement is going to be relaxed in the next revision of the standards, but no compilers have implemented that yet (for obvious reasons)

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

If the answer is not in your text book then you need a different book! But I'm sure its in the book, you just need to study the sections about C language program structure.

// includes go here
#include <stdio.h>
...
int main(int argc, char* argv[])
{
    // all variable declarations go here
    //
    // executable statements follow
    //
    {
         // new block, so more variables here
         // followed by executable statements
    } // end of block
} // end of main() function
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can't put executable statements before variable declarations in C language.

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

I think your loop is wrong

int main()
{
    char op;
do{
	printf("\n");
	printf(" A : Quadrado\n ");
	printf("B : Rectangulo \n");
	printf(" C : Circulo\n");
	printf(" D : Triangulo\n");
	printf(" E : Trapezio\n");
	printf(" Indique a opcao : ");
	scanf("%c",&op);

    op = toupper(op);
  //  cin.ignore(256);
//	printf(" Opcao Invalida \a");
	
} while( op < 'A' || op > 'E');

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

read() may not work because it would also read in the '\n' line terminators. I think call get() to read each character one at a time would work, convert the char to int when inserting into the grid

char c;
ifstream in("filename.txt");

in.get(&c);
// or this
in >> c;

grid[i][j] = c-'0'; // convert char to int
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

read them in as characters so that you can read them one character at a time.

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

I tried the basic example and that was okay.
But uploading/downloading won't work...

What do you mean by uploading/downloading? Uploading what from where? Does that have anything to do with copying a file or is that a different problem ?