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

Your program looks nice but your use of boost library is probably not allowed in his program. It's like hitting a nail with a sludge hammer, way too overkill.

ModernC++ commented: If I don't use at least one function/class from boost (at least STL) in 50 lines of code I may explode +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to have another counter that stores the index value of the highest number then add another line to the if statement on line 20 to set that integer to the current value of i loop counter. Don't forget to put { and } around that if statement.

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

The file was written on one operating system such as MS-Windows and you are trying to view it on another os such as *nix. The only way to remove those rectangles is to translate the file from MS-Windows to *nix. MS-Windows uses two bytes as a line terminator -- "\r\n" while *nix and MAC only use one byte. Many file transfer programs will make that translation for you, but you can also do it yourself by writing a program that reads the file then remove the \r and finally rewrite it.

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

you can not delete arrays or other objects that were not allocated with new. All you have to do is delete line 85 because its not needed.

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

check the return value of fopen() -- its probably failed to open the file. Does the file exist in the current working directory?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;

class Student 
{
private:
    int id;
    string name;
    string lname;
    char gender;
    string dob;
    string major;
    double gpa;



public:

    int credits;
    Student();
    void setStudent(int, string, string, char, string, string, int, double); 
    void getStudent();

};
Student::Student()
{   id=6984; name="John"; lname="Trovota"; gender='M'; dob="1/1/1980"; major="CIS"; credits=64; gpa=3.75; }
void Student::setStudent(int i, std::string n, std::string l, char g, std::string d, std::string m, int c, double p) 
{      id=i; name=n; lname=l; gender=g; dob=d; major=m; credits=c; gpa=p;    }
void Student::getStudent() 
{ cout<<id<<"  "<<name<<" "<<lname<<"  "<<gender<<"  "<<dob<<"  "<<major<<"  "<<credits<<"  "<<gpa<<endl; }

bool cmp( Student s1, Student s2 ) {
return s1.credits < s2.credits ;
}


int main()
{
    vector <Student> userData;

    Student s1;
    userData.push_back(s1);
//    s1.getStudent();
    Student s2;
    s2.setStudent(2323, "Brittney", "Speer", 'F', "5/23/1984", "BIS", 78, 2.98 );
    userData.push_back(s2);
//    s2.getStudent();
    Student s3;
    s3.setStudent(1452, "Kathy", "Johnson", 'F', "12/25/1982", "CIS", 30, 3.33 );
    userData.push_back(s3);
//    s3.getStudent();
    Student s4;
    s4.setStudent(4321, "Bill", "Newton", 'M', "7/8/1976", "BIS", 100, 3.95 );
    userData.push_back(s4);
//    s4.getStudent();

    std::sort(userData.begin(), userData.end(), cmp);
    for(size_t i = 0; i < userData.size(); ++i)
        userData[i].getStudent();


    system ("pause");
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

look at the code (loop) I posted

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  1. Delete line 63 --

  2. You have to call getStudent() after the vector is sorted, not before. Call getStudent() from the vector, not the individul Student objects. You need to delete all those lines that call getStudent() and replace them with the following loop AFTER the array has been sorted.

    for(int i = 0; i < userData.size(); i++)
    {
    userData[i].getStudent();
    }

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

Student::credits is NOT a function, which is what the error message told you. Line 38 is wrong -- remove the parentheses.

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

maybe you should ask that question in the Acrobat SDK forums?

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

put the cmp() function back the way you had it in your first post, there was no reason to change it. Then just delete line 61 because you don't need a function named sortVecByCreditsAscending.

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

In c and c++ languanges arrays do not have negative index values. If you tried to print that then it is by coincidence that the program worked at all. One reason it may have worked for you is if you declared two integers just before you declared the array so that the program was actually looking at one of the two integers instead of the array. For example

int a;
int b;
int arr[5];
printf("%d", arr[-2]);

If the above does not crash when you run the program what will get printed is the value of variable a. But there is no guarentee that the program will do that either. Because C language does not support negative index values the result of the program is called undefined behavior.

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

Line 47 is too early because the vector doesn't contain anything at that point. Programs run from top to bottom, so the first thing in that main() that gets executed is line 47. You need to move that line all the way down to between lines 59 and 60.

Next, you have to add the 4 objects to the vector. Just declaring them doesn't do that. For example, between lines 53 and 54 you need to add v.push_back(&s2); Do something similar after each of the other student objects have been initialized.

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

You have not populated the vector v with student class objects. After you do that then you can call std::sort() to sort the vector. pass std::sort() the cmp() function you have already written as the last parameter.

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

why did you post this?

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

Strange i run into more errors with C++ than C.

C is an older language, but c++ is a much stricter language. There are lots of things that you can get away with in C that you can't in c++, and C will let you hang yourself a lot faster. Although c++ is derived from C a C program will probably not compile with a c++ compiler without making some changes.

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

wap??? huh? speak engligh please

Banfa commented: Erm pot kettle black? ;p +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is nothing special about the keyboard except it has eluminated keys. Its a Logitech that I bought off-the-shelf at Best Buy.

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

Accoding to this you can get pmp certs in 4 days.

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

maybe once a second is too frequent -- slow it down to once every 15 seconds and see if it still gives errors.

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

delete line 6 and just make normal assignments inside he function. AFAIK you can only do what you did on line 6 with class reference variables, which id_ and name_ are not.

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

Don't post anything that is copyright by someone else without their permission. The accepted way to do that is to post a partial quote then add a link to the original article.

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

Update: I used bcdedit.exe to change the default settings, and now I can't boot the computer at all because ubuntu installation apparently failed and the screen just shows a redish colored screen when it attempts to boot to ubuntu. I'm writing this post on another one of my computers. I'll check out the suggestion to see if there is a mother board setting, can't get to the bios either because no keyboard that works.

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

My computer has USB keyboard and mouse. After using the Windows installer to install Ubuntu on my system and rebooting, the duel-boot menu popped up where I can select either Windosw 7 or Ubuntu. The problem is that my keyboard doesn't work at that point because it is USB, so I can't change the selection.

Anyone know a work around? PS2 or serial keyboard is not an option because my motherboard doesn't have either port. Can I change the default option while in Windows then reboot, and do the same in Ubuntu before rebooting? If so, how?

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

doesn't work as described in the Formatting Help button either, just putting either 4 spaces or one tab in front of each line.

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

ideas or suggestions about what? From the description it appears to be just a simple swapping algorithm, take two pairs and swap their cell values. Most sorting algorithms do something similar. The first step would be to get a pair, 1A for example, then convert it into indices that C/C++ can understand, 1A = 0 and 0

int array[5][5];
char* pair = "1A";
int a,b;
a = pair[0] - '0' - 1;
b = pair[1] - 'A';
int value = array[a][b]
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what does it do or what does it not do that you want it to do? We need a bit more information about that the problem is. I can tell you that you don't need line 29.

Please don't create new threads to ask additional questions about the same problem, just add another post to the thread you already created. Its less confusing for everyone.

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

After posting code using the Code button no line numbers appear and I can't double-click to highlight the posted code. See this thread. Everything works correctly in the original post to that thread, but not in mine where I used the Code button.

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

remove the brackets on lines 15 and 18 because they are not necessary. Also format the program a little better to make it easier for you to follow the flow of the program.

    #include<stdio.h>
    int main()
    {
        int numArrays[] = {2, 67, 23, 5, 7, 34, 14, 4, 8, 62};
        int i, sum=0, 
        double ave=0;
        for(i=1; i<10; i++)
        {
            if(numArray[i]%2==0)
            {
                printf("%d", numArray[a]);
                total += numArray[a];
            }
        }
        sum=sum+total;
        printf("the total of all even number is; %d", sum);
        ave=(float)sum/n;
        printf("the average of all even numbers is: %f", ave);
        returtn 0;
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your program is missing { and } around the if statement because the if statement consists of multiple lines

if(numArray[i]%2==0)
{
    printf("%d", numArray[a]);
    total+=numArray[a];
}

Line 20 also has a problem: variable n was never declared, and the result will only be an integer because ave is an integer.

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

line 5: remove "Dim ;" -- that's not a valid statement

line 7: remove the ; from the beginning of the line and put it at the end of the previous line

line 18: The number of parameters and type of parameters must match exactly with those shown in the function prototype that appears on line 5. If you want function atotal to have a parameter then you have to specify it in the function prototype.

line 20: the statement is formatted incorrectly. Should be like this: for(a = 0; a < itotal; ++a)

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

Interesting ... but you failed to ask the question, or I failed to find it.

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

Yes, use call Sleep() to make the program pause for the desired about of time then rewrite the text.

#include <iostream>
#include <windows.h>

int main()
{
   cout << "Hello ...";
   Sleep(2000); // wait for 2 seconds
   cout << "How are you?\n";

}

It's something similar with Windows Forms or MFC dialog boxes except instead of using cout to write the text you have to change the text in a static text control -- just give the text control property a name and you can easily change the text just as you might in an edit control.

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

Will this encourage multiple accounts if emails are different?

That's exactly what happened to me. But then members could always do that. Its only a problem if the member gets banned for one reason or another -- ban one account and all accounts by that member get banned when found. At least that's the way it worked when I was a mod.

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

You don't need to decompile a compiled program just to read the strings, any program such as debug.exe will easily display that along with the hex values of all the non-text bytes.

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

I mean this button

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

Here isn't much to them. Here are some links you should read. Not all compilers implement them.

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

hiroshima flavor hotwinds and beer from Showme's

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

If you mean a script that runs on MS-Windows or *nix? Those are not real time operating systems, so there is no way to schedule someting to run at exactly the same time, such as exactly at 1 minute intervals. If you need that kind of accuracy then you will have to get a different operating system. You might find that task scheduling is more accurate on multi-core computers.

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

Serial communication is inherently sloooow, which is one reason hardware manufactures switched to USB. This is one are in which MS-DOS 6.X did a lot better than MS-Windows or *inix because MS-DOS was pretty close to a real-time operating system and programmers had complete access to the hardware and ports.

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

Do you mean which compilers you should use? Of course before you can write a program you have to know something about what the program is to do. For example you can't write a program to fly a ship from Earth to the moon without knowing something about astronomy. You can't write a program that does financial calculations without knowing something about business and/or accounting.

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

line 10 is impossible because merge_sort() does not take that many parameters. The number of parameters on line 10 have to match exactly the parameters on line 1. You can give them different variable names, but the number and type of parameters must be the same.

The value of mid is calculated on line 5.

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

PLease help me in adding files to this code is it very simple for

What exactly is your question? What compiler? what operaring system? WWat do you want the files to contain? Please explain your needs in greater detail.

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

I'm hoping for someone hopefully with a law background to give me an overview of what needs considering.

That's not advisable -- its similar to asking someone with a little medical training to give you advance about an operation. Go see a licensed lawyer for legal advice, and go see an MD for medical advice.

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

I feel that it should work fine but some problem is in memory allocation

Contridction! if there is a prblem then it is not working find :)

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

That behavior is nothing new -- they've been doing it every since TV was invented. I remember lots of talk about the same subject when I was a kid, some 50 years ago (or so ).

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

Here is one way to add an icon to your C or C++ programs.

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

Since the table is an array of integers, there is no such thing as null elements, every element has a value. NULL is defined as 0 in most operating systems and compilers, and that's why p[0[0]=NULL doesn't work the way you want it to work. A work-around is to set the element to some number that is not likely to be entered then test for that number. If all the valid numbers are poitive then you can set NULL elements to -1.

for (int col = 0; col < cols; col++)
{
   if( p[row][col] < 0)
      cout << setw(5) << " ";
    else
            cout << setw(5) << p[row][col];
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

fprintf(fp,"%s %s",ii->nome,ii->num);

The problem is that you have to put '\n' at the end. And your program won't work at all if you put a space in the name that you enter, such as "John Smith" or something like that.
fprintf(fp,"%s %s\n",ii->nome,ii->num);

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

Go shopping, play Diablo III game, or visit DaniWeb. Occasionally I'll drive to one of the near-by tourist attractions for the day.