NathanOliver 429 Veteran Poster Featured Poster

well in the ouptut function a and c are being passed to the function and in the input function radius is a global variable and doesnt need to be passed

NathanOliver 429 Veteran Poster Featured Poster

so you want the system call to say "Net User name"? If that's all then you can use a string and put the two parts together and then pass the whole thing to system.

string command = "Net User ";
string name;
cout << "please enter the user name: ";
cin >> name;
commmand += name;
system(command.c_str());
NathanOliver 429 Veteran Poster Featured Poster

You should be able to get rid of it and still have compile. I believe stdafx.h is used to make non console based win32 programs.

NathanOliver 429 Veteran Poster Featured Poster

So your sub set does not need to be continuous then?

NathanOliver 429 Veteran Poster Featured Poster

In order to do this you will need to open the files and then tranfer the data bettwen them. If you want to do this with OOP you will need to read up on using fstream. the string class will also be helpful

NathanOliver 429 Veteran Poster Featured Poster

Where is your temp variable coming from?

NathanOliver 429 Veteran Poster Featured Poster

This should help you to get the arguments

[EDIT]
Wow Narue you are quick with the keyboard. Remind me never to get into a typeout with you.
[/EDIT]

NathanOliver 429 Veteran Poster Featured Poster

there is a simple approach to this problem. start at the begining of the array and sum all of the elements untill you reach your goal. then you need to store the begining and end posistion of that subset. then you will start at the 2nd element of the array and do the same process. if your result is better than overwrite the posistions and the total. keep doing this untill you run to the end of the array and your total is still not greater than the number you are looking for

NathanOliver 429 Veteran Poster Featured Poster

the problem is you are using uninitialized variables to do your computations. in case 2 you are using yearsWorking without ever storing a number in there.

NathanOliver 429 Veteran Poster Featured Poster

Why are you even declaring aonther DAI? If you want to youse the getCountry function all you have to do is

for(int i=0; i < answer; i++)
{
    A.push_back(DAI());
    A[i].getCountry();
}
NathanOliver 429 Veteran Poster Featured Poster

The c++ standard gives no guarantee that a variable will be initialized to zero or null. Some compilers may add this functionality in but it is not guaranteed. You should always initialize your variables when you declare them. This is especially true for counter variables.

NathanOliver 429 Veteran Poster Featured Poster

if you want to get totals for each item you will need a seperate array. then you can add the price into that array based on what they order.

double totalItemPrice[8] = {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00);
// in you do loop
cost += menu_list[order-1].menu_price;
totalItemPrice[order-1] += menu_list[order-1].menu_price;
// ...

now all you have to do is run through the array and any it will have the totals of each item.

NathanOliver 429 Veteran Poster Featured Poster

I would actually break this up into two functions. The function you have now would just be used to parse through the array and handle the return from the helper function. In the helper function I would do the calculations to find out if there was an increase or decrease in profits by simply subtracting the first value in the array from the last value. If the number is positive the profits increased and if its negative they decreased. To determine if it was steady or not will need a loop. Start at the front of the array and then step to the end. As you go through the array check and see if the difference between the values is always positive or negative. if the is a change then you know it is fluctuating.

NathanOliver 429 Veteran Poster Featured Poster

What error are you getting? From the look of it you might need to define a operator= for your mat class. Also it is bad coding practice to define large functions inside the class. You should define them outside like

class Foo
{
    //...
    int Bar(int);
    //...
}

int Foo::Bar(int foobar)
{
    //...
}
NathanOliver 429 Veteran Poster Featured Poster

This looks more like c code and not c++. If you want to code this in c++ I would suggest using the string class in the stl. What error is your compiler giving you or does it crash while running?

NathanOliver 429 Veteran Poster Featured Poster

how complicated of an expression are you looking to solve?

NathanOliver 429 Veteran Poster Featured Poster

IMHO any class or function that you write that you use with different data types should be a template so you don't have to keep copy and pasting code and possibly creating an error in doing so. That said if you are writing a simple function for a program and you feel you will only use it there then there really isn't any advantage to template it. I would equate it to non library functions and library functions. with non library functions they get used in one program and that's mostly it. with library function they get used in many programs and should be flexible enough to not be changed.

NathanOliver 429 Veteran Poster Featured Poster

line 10 should be count1 = count1 * 3

NathanOliver 429 Veteran Poster Featured Poster

you could creat a couple of function like GetLetterInput and GetNumberInput and have them do the work so in your main function you wouldn't have to do all of the data validation. an example of how GetLetterInput might work is,

ifstream & GetLetterInput(ifstream & stream, int & input)
{
    int number = 0;
    string temp;
    for(;;)
    {
        cin >> temp;
        number = atoi(temp.c_str());
        if (number != 0)
        {
            input = number;
            return stream;
        }
        else if (number == 0 && temp.size() == 1 && temp[0] = '0')
        {
            input = number;
            return stream;
        }
        else
            cout << "Invalid Input.  Please enter a number: ";
    }
}

this is just an example and i have not verified that this works

NathanOliver 429 Veteran Poster Featured Poster

is B defined? I mean are you using this in a template function or class?

NathanOliver 429 Veteran Poster Featured Poster

in your .cpp file you will need to include the .h file that the defenition is in. than you define the functions like you would a normal function but you have to add the class name to the front of the function name. note that if you are using templates you have to define the functions in the .h file

#include "class.h"

void ClassName::Function(int foobar)
NathanOliver 429 Veteran Poster Featured Poster

a charecture is one byte long. to prove this try this code

#include <iostream>

int main()
{
    char ch;
    std::cout << sizeof(char);
    std::cin.get();
    return 0;
}
NathanOliver 429 Veteran Poster Featured Poster

Does this code work? There is no type for the variables first and last.

NathanOliver 429 Veteran Poster Featured Poster

I would have the variable passed into the constructor of each class

NathanOliver 429 Veteran Poster Featured Poster

Check this out.

NathanOliver 429 Veteran Poster Featured Poster

@ richieking He already has the algorithm to make a solid rectangle he is trying to make an empty one. Also what you have puts an extra Astrix on each line so your rectangle would be 10x21.

NathanOliver 429 Veteran Poster Featured Poster

Please use code tags and standard code when posting. Also please don't resurrect dead threads. You must have seen the warning before you posted.

NathanOliver 429 Veteran Poster Featured Poster

I would put an if statement in your second for loop for the empty rectangle and check to see if you are not on the top or the bottom of the rectangle. If you are not on the top or bottom then only place an Astrix on the ends otherwise place all Astrix.

NathanOliver 429 Veteran Poster Featured Poster

I hate to nit pick but isn't the assignment supposed to use linked list? An array is not the same as a linked list. For info on linked list check this out

NathanOliver 429 Veteran Poster Featured Poster

Another use for pointers is for passing to functions. When you pass a pointer to a function anything you do to it inside your function is retained in the calling function

void foo(int a)
{
    a += 5;
}

void bar(int * a)
{
    *a += 5;
}

int main()
{
    int a = 3;
    std::cout << "a is: " << a << std::endl;  // will be 3
    foo(a);
    std::cout << "after foo() a is: " << a << std::endl;  // will be 3
    bar(&a);
    std::cout << "after bar() a is: " << a; // will be 8
    return 0;
}
NathanOliver 429 Veteran Poster Featured Poster

Can you post what you have right now?

NathanOliver 429 Veteran Poster Featured Poster

Thanks for that little tidbit Mike. Didn't know they did that.

NathanOliver 429 Veteran Poster Featured Poster

can you attach you master.dat to the forum so when can have the actual file? You might have to rename it to a .txt file to attach it.

NathanOliver 429 Veteran Poster Featured Poster

I had meant for you to do this

//...
cout << "How many students do you want to enter: ";
cin >> students;
cin.get();  // or cin.ignore (80, '\n');
cout << "\nFor each student, you will be prompted for a name and "<< NUMBER << " test scores\n" << endl; 
/...
NathanOliver 429 Veteran Poster Featured Poster

After line 21 write cin.get() . The problem comes from having mixed input. For more information check this out.

NathanOliver 429 Veteran Poster Featured Poster

this is the data i used for master.dat

jones 44
smith 74
thomas 88
ralph 56
sue 90
jane 73
mavis 77
joyce 33
pete 56
jacob 28
emily 99
michael 89
madison 45
joshua 85
hannah 92
matthew 10
emma 65
ethan 23
alexis 8
joseph 56
ashley 83

and this is what i got in output.dat

alexis 8
matthew 10
ethan 23
jacob 28
joyce 33
jones 44
madison 45
ralph 56
pete 56
joseph 56
emma 65
jane 73
smith 74
mavis 77
ashley 83
joshua 85
thomas 88
michael 89
sue 90
hannah 92
emily 99
NathanOliver 429 Veteran Poster Featured Poster

I cant say what is going on. I would suggest you follow pseudorandom21 advice and change how you read the file in. With that said I did an exact copy and paste of you data file you provided and the code you provided. The only things I changed in your code was to delete line 132 and I commented out lines 94-120 and lines 144-160.

NathanOliver 429 Veteran Poster Featured Poster

instead of using a while loop ask the user for the number of students and then use that as the stop condition in a for loop

// in main
cout << "How many students do you want to enter: ":
cin >> numberOfStudents;
for (int i = 0; i < numberOfStudents; i++)
{
    // code for getting students goes here
}
// more code
NathanOliver 429 Veteran Poster Featured Poster

I compiled your code and the only thing I had to change was to delete line 132. When working with iterators like you are you don't need to step one back from the the end. I could not get a duplicate of the data in the output though so I'm not sure why you are

NathanOliver 429 Veteran Poster Featured Poster

on line 72 you are checking to i <= 5 which will put you out of the bounds of the array. try changing it to i < 5 .

NathanOliver 429 Veteran Poster Featured Poster

the problem is that if you try to enter a letter into a integer it will fail and cause cin to enter an error state and it will cause your program to loop forever. if you want to make it bulletproof you will have to get the input as a string and then test it to see if it is what you want.

[EDIT]
Crutoy beet me.
[/EDIT]

NathanOliver 429 Veteran Poster Featured Poster

Please show the code you have now and we can help you out.

NathanOliver 429 Veteran Poster Featured Poster

I would suggest you read the file one line at a time using getline. After you read in the line pass it to a function that will go through the string and check for lowercase letters. Here is a way to get a counter for the lowercase letters

int main()
{
    int lowercase[26];
    for (int i = 0; i < 26; i++)
        lowercase[i] = 0;
    // check string for lowercase letters
    if (letter == lowercase letter)
        lowercase[letter - 97] += 1;
}
NathanOliver 429 Veteran Poster Featured Poster

to sort the list using sort you would have to do

sort(theList.first(), theList.end(), compareFunction);

the compareFunction is one that you would have to write to compare the avg of one object to the avg of another object. this should help you out.

NathanOliver 429 Veteran Poster Featured Poster

The modulo operator simple finds what the remainder is after dividing by a number. So with integer division 20 / 3 = 6 but 6 * 3 = 18 so there has to be a remainder of 2. you get the remainder by subtracting the divisor times the answer from the number.

//  find the whole part
20 / 3 = 6

// multiply to find out how short we are
6 * 3 = 18

// subtract to get the remainder
20 - 18 = 2

This should help you create a solid function.

NathanOliver 429 Veteran Poster Featured Poster

you should have the input be read in as a sting and test if it is empty. if it is then quit and if it is not then continue.

NathanOliver 429 Veteran Poster Featured Poster

what is the & for in DLSortedList * newList = new DLSortedList(dlSL&) ? i think you might want to be doing DLSortedList * newList = new DLSortedList(&dlSL)

NathanOliver 429 Veteran Poster Featured Poster

Have you ever used regedit?

NathanOliver 429 Veteran Poster Featured Poster

here you go.

NathanOliver 429 Veteran Poster Featured Poster

Could you post your code if you haven't figured it out?