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

since you didn't post it I have no clue.

>>could you explain how this works when executed in C?
#define's are NOT executed at all in C. The compiler's preprocessor expands all #defines and #includes before the compiler sees the code.

If this doesn't explain what you want, then you need to post an example so we know exactly what you want.

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

QT and wxWidgets are also somewhat platform independent.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
open the original file for reading
open a new temporary file for writing
for each line in the original file
   if this does not contain the text to be deleted 
           then write the line out to the output file
end of loop
close both files
delete the original file
rename the temp file to the name of the original file
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In order to deleted text from a file you have to rewrite the entire file but omitting the text to be deleted. you can't just delete text in the original file.

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

you didn't say if you have a problem with the >> operator or not. And if there is a problem, what is it? Looks like it should work to me.

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

>>int numcols = 11;
>> char line1[numcols], line2[numcols];

Does that even compile for you ?

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

Temp is an unitialized and unallocated pointer. See the two lines I changed below

void Deque::Addfront(int n)
{
    Temp = new node; // <<<< Here
	Temp->value=n;
	if (front==NULL)
	{
		Temp->link=front;
		front=back=Temp;
	}
	else
	{
		Temp->link=front;
		front = Temp; // <<<< here
	}
return;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>cin << C;

wrong. should be cin >> C;

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

This is a pretty good one for you to code. Just change the requirements to use a vector of Student classes instead of three simple arrays, and use std::sort instead of writing your own. If you don't know vectors and classes very well, that will give you some practice in working with them. Otherwise the rest of that assignment is pretty trivial for someone with good grasp of c++ programming.

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

Aren't you the witty one? ;)

When you get my age you can afford to be because I don't really care one way or the other. :)

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

dont give me that let me google that for you bs

Did it work :) :) :)

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

in the displayAR() function you have to put spaces between each number. as shown in my previous post that discusses the setw() function.

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

its probabably that while statement. when point == nextpost, when does nexpoint == 7? Lets say nextpoint == 2. The loop will become infinite because 7 != nextpoint is always true.

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

have no idea because it isn't c or c++.

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

Since you know next to nothing about C and C++ I would recommend you just use some off-the-shelf charting software, such as this one, where you don't do any programming at all. More links here.

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

Here are some links

If the cobol program writes the data to a disk file then a c or c++ program should be able to read it.

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

That was over 2 years ago. Instead of complaining in the thread you should have reported it. The Dude did not have any rep altering power so the bad rep he gave you only put a yellow dot on your profile.

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

If you really want a response then you need to post the code you have done or tried.

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

You can't get much better than these tutorials.. If you don't understand them then maybe you are not ready yet for socket and network/internet programming.

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

Here is a good tutorial on pointers.

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

The code snippet I previously posted above is part of that display function.

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

line 22: That is not the correct way to display the contents of an array. You have to do it in a loop, and you need to display the contents of all three arrays.

for(int i = 0; i < 20; i++)
{
    cout << zid[i] << " " << ...
}

The above will only partially satisfy the requirements of your assignment. use the setw() function to space out the columns in the report cout << setw(20) << zid[i] << setw(25) << ... The numbers I put here are only guesses, you will have to test and modify them to suit yourself and the requiremenets of your assignment.

Sorting the arrays: I don't see a requirement to use any specific sort algorithm, so IMO the bubble sort algorithm is the easiest to code. Google for it and you will find lots of examples.

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

Don't use [list] [/list] tags. [code=cplusplus] ... [/code] will do the job of adding line numbers just nicely.

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

you need some { and }s.

while (indata)
    {
    if (letter >='a' && letter <='d')
    {
       pass++;
       all++;
       }
      else    (this is where the error is)
       if(letter >='d' || letter <='f')
      {
       fail++;
       
       valid=(pass+fail);
       }     
     else
    {
       outdata<<letter<<endl;
       all++;
       indata>>letter;
       }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

5 cups a day may not kill you but it sure wil wreak your nervous system.

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

I stopped smoking in Sep 2001 after roughly 40 years. Stopping is not easy and took many attempts. At 2 packs a day guy, and $4.00 USD/pack (cost when I quit), I figure I have saved at least 5,840 packs or $23,360.00 USD. Cigs are now about $6.00USD/pack where I live. I can buy a really nice new car for that much :)

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

Put $1,000,000.00 USD in my paypal account and I'll write it for you. If you can't afford that, then you will just have to post what you have done and ask questions about parts you don't understand. Sorry, but no freebies here.

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

You could check before adding it to the vector.

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

might be because on or both strings are uninitialized. If you are using a modern compiler its unlikely stack space is the problem.

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

There are thousands of examples posted here -- just read some of these threads and attempt to solve the programs yourself.

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

Guess I got the wuss's compiler then, lol.

oh and that would require .h file I made, which would be of little use to atreides because he does not have it >_>(okay so I could have given it to him but thats to much of a hassle)

Dev-C++ is getting a little ancient now because it isn't being updated. Download free Microsoft VC++ 2008 Express for more current implementation of c++ language. Or even Code::Blocks IDE uses more current version of minig compiler (I think that's it).

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

Yes, I erased a parentheses when fixing the color manually.
It should be: while((c = fgetc(fp)) != EOF)

Ohhh I see my mistake now -- wasn't the parantheses, but the fgets() function instead of fgetc(). Thank you for the correction. :)

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

>>but the class string is included in <iostream>
If that is true with Dev-C++ then that is some compiler-specific thing which no other compiler in the world has implemented.

>>BUT, I do know to solve problems quite well, and I can say with certainty that my palindrome function that uses stacks works perfectly with your case

Then you should have posted it :)

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

He really meant while((c = fgetc(fp) != EOF)

Nope. You have mis-matched parentheses. Count them.

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

>>I wish you were our ... tutor

I am. :)

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

>>anyways, this will compile on devc++
You forgot to include <string> :)

line 4: must be int main() because c++ does not support default return types.

It might compile, but does it work? If I enter "wom" will it produce a false positive? The loop on line 12 will not execute because (3/2)-1 = 0.

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

>>how to create backwards loop

for(int i = vectorObject.size()-1; i >= 0; --i)
{
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is how I would write a paladrone function

bool IsPalindrome(const char* string)
{
    int len = strlen(string)/2;
    const char*p1 = string;
    const char* p2 = string + strlen(string)-1;
    while( len-- > 0)
    { 
        if( *p1++ != *p2--)
            return false;
    }
    return true;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) c must be of type int, not char, because EOF won't fit in a char.

2) Open the file in binary mode and read it one character at a time. The function readFile() is very dangerous because you have no clue how much memory was allocated for the string!

int spot = 0;
int c;
while( (c = fgets(fp) ) != EOF)
{
    string[spot++] = c;
}
string[spot] = 0; // null-terminate the string
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I tried to compile your program:
1) check function name spelling and capitalization. They must match exactly.

2) Check data types of the arrays. You declared them as float but the function buildAr() expects doubles.

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

Probably due to settings. What compiler and os are you using? Make sure the file "LinkedList.h" actually resides on your hard drive in the same directory as the *.cpp file you are trying to compile, and check the file's spelling. It doesn't have to be in the same directory, but makes life a lot easier if it is. As you gain more experience you will learn not to put header files in other directories.

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

Hello,

With me being new at c++ I sometimes get a bit overwhelmed by it all.

Yes, we all have been there and done that. We we understand your pain.

I never meant to be insulting to you or anyone.

No offense taken, so don't worry about it.

I, in fact, am very much envious of your expertise and respcect you.

You'll get there too. Just takes a lot of practice and patients.


I would appreciate it you could look at what I have done today, which will clarify the area of concern.

I would, but you haven't posted any code today, and my eyesight isn't good enough to see your monitor :)

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

lines 17 thru 19 looks like a data object because of the brackets [ and ]. Replace them with parentheses ( and ) to make it a function call.

Also note that buildAr() takes 3 parameters, not one. So you can consolidate lines 17-19 into just one line: buildAr(zip, pgmavg, testavg);

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

>>//Shifting should happen here as far as i know

As long as the original string and the new string have the same length there is no need for shifting. If however the original values are not the same it is not safe to change the size of the original *.exe file because you will change the location byte offset of its program variables and other symbols.

Also, you might corrupt the program's stack and other data areas by changing string lengths. Example: originally a program might be like this:

int main()
{
    char ip[] = "127.0.0.1";
}

Now if the program you are writing changes the text to "255.255.255.255" you will be changing the length of the string that the compiler had allocated for the original value. That is not good news!

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

1) you have to ask nicely :) But we normally don't delete posts unless it violates one or more of the DaiWeb Rules.

2) Click the "Go Advanced" button, scroll down to "Manage Attachments".

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

you need to create a loop and ask the the 10 numbers one at a time

for(int i = 0; i < 10; i++)
{
   cout << "Enter number #" << i+1 << "\n";
   cin >> num;
   list.push_back(num);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 31 and 32: >> temp= &p; rowcol= atoi(temp);

That can't possibly work because atoi() expects a null-terminated string, and p is just a single character. There is an easier way to convert a character to int -- just subtract '0':

if( isdigit(p) )
    rowCol = p - '0';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't understand what you are asking. How to output the vector in referse order? Just create a loop that counts backwards.

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

>>i need to concatenate the two words
Yes, use strcat() for that. strcat(s1, s2); That works as long as the length of the two strings do not exceed the space allocated for s1 (which is 100).

>>also somehow need to test to see if the word is a palindrome
create another buffer, such as s3, copy the string backwards, then compare it with the original string. Another way is to use two pointers, one that starts at the beginning of the string and the second to start at the end of the string. Then compare the two pointers one character at a time.