[QUOTE=Nick Evan;1146413]Since this is obviously homework, first tell us what [I]you[/I] think the answer should be (and why).[/QUOTE]

Im at a total lost for the first problem but for the second problem I think it would be 0000000000100001110 because it would be 20 bits without changing the value of the interger and it remains in 2's complement

the largest negative and positive integers for n-bit 1’s and 2’s complement systems? What are these numbers for 32-bit registers?

If (1000001110)2 is an integer in a 10-bit 2’s complement system, what is the binary code for it in 20-bit 2’s complement system?

I tried the code given and thier is still a blank output screen

[QUOTE=programmersbook;1061240]this should help:

[CODE]void printRetrieve(studentList & students)
{
cout << "printing list"<<endl;

for( studentList::iterator it = students.begin(); it != students.end(); it++ )
    cout<< *it<<endl;

}[/CODE]

this is a copy, the list wont be altered
[CODE]enrollStudent(studentList l);[/CODE][/QUOTE]
I tried the code given and thier is still a blank output screen

Can someone help me figure out why nothing comes up on the output screen. The program compiles but the the output is blank.

  1. Maintain information on all students. Each student has the following:

1st line - lastname, city of residence, student id, ssn

2nd line - course, course id, course department, credit hours, grade (number representation... ex. A = 4, B+ = 3.3, C- =1.7 etc)

Note - Each student will initially be enrolled in 5 courses... However, the user should be able to add or drop a course (along with its corresponding information) at will!

**Please review the text file, registration.txt, attached before you submit your program, as the text file is very specific!!!

  1. The program should be menu driven and possess the following features in seperate functions:

a. Menu

As a selection within the menu, the user should be able to:

b. Print Students in Alphabetical Order

c. Retrieve a Student & Prints Their Corresponding Information

d. Add a Student Record

e. Delete a Student Record

f. Add Student in a Course

g. Delete Student from a Course

h. Print a Student Report - Total Credit Hours
[code]

include<iostream>
include<list>
include<fstream>
include<algorithm>

using namespace std;
typedef list<int> studentList;

typedef studentList::iterator list_it;
void loadList(studentList & students);
void menu(int &selection);
void addStudent(studentList & l);
void enrollStudent(studentList l);
void sortStudent(studentList & students);
void deleteStudentRec(studentList & l);
void deleteStudentCour(studentList & l);
void retrieveStudent(studentList l);
void printRetrieve(studentList & students);

int main ()
{
studentList students;
loadList(students);
addStudent(students);
enrollStudent(students);
sortStudent(students);
deleteStudentRec(students);
deleteStudentCour(students); ...

It would help if you posted the output you were supposed to have and what output you got

the output im getting is

Please enter numerator2
Please enter denominator4
10/8
28/16
-2/8
-12/16
24/8
384/16
6/8
1/16
Press any key to continue . . .

its suppose to add subtract mulitplty etc fractions

can someone help me figure out why my output is incorrect any help would be apprecaited
[code]#include<iostream>
using namespace std;

class fractions
{
public:
fractions fractions :: operator+(fractions f);
fractions fractions :: operator-(fractions f);
fractions fractions :: operator*(fractions f);
fractions fractions :: operator/(fractions f);
fractions addFraction(fractions);
fractions subFraction(fractions);
fractions multiFraction(fractions);
fractions divideFraction(fractions);
fractions();
fractions(int, int);
void getFraction();
void printFraction();
private:
int numerator;
int denominator;
};

//method to add two fractions
fractions fractions :: addFraction(fractions f)
{
fractions temp;
temp.denominator = denominator f.denominator;
temp.numerator = numerator
f.denominator + denominator f.numerator;
return temp;
}
//method to add two fractions
fractions fractions :: operator+(fractions f)
{
fractions temp;
temp.denominator = denominator
f.denominator;
temp.numerator = numerator f.denominator + denominator f.numerator;
return temp;
}
//method to subtract two fractions
fractions fractions :: subFraction(fractions f)
{
fractions temp;
temp.denominator = denominator f.denominator;
temp.numerator = numerator
f.denominator - denominator f.numerator;
return temp;
}
//method to subtract two fractions
fractions fractions :: operator-(fractions f)
{
fractions temp;
temp.denominator = denominator
f.denominator;
temp.numerator = numerator f.denominator - denominator f.numerator;
return temp;
}
//method to multiply two fractions
fractions fractions :: multiFraction(fractions f)
{
fractions temp;
temp.denominator = denominator f.denominator;
temp.numerator = numerator
f.denominator denominator f.numerator;
return temp;
}
//method to multiply two fractions
fractions fractions :: operator(fractions f)
{
fractions temp;
temp.denominator = denominator
f.denominator;
temp.numerator = numerator f.denominator denominator * f.numerator;
return temp;
}
//method to divide to fractions ...

can someone help me figure out why the output of my program is coming out wrong
[code]

include<iostream>

using namespace std;

class fractions
{
public:
fractions fractions :: operator+(fractions f);
fractions fractions :: operator-(fractions f);
fractions fractions :: operator*(fractions f);
fractions fractions :: operator/(fractions f);
fractions addFraction(fractions);
fractions subFraction(fractions);
fractions multiFraction(fractions);
fractions divideFraction(fractions);
fractions();
fractions(int, int);
void getFraction();
void printFraction();
private:
int numerator;
int denominator;
};

//method to add two fractions
fractions fractions :: addFraction(fractions f)
{
fractions temp;
temp.denominator = denominator f.denominator;
temp.numerator = numerator
f.denominator + denominator f.numerator;
return temp;
}
//method to add two fractions
fractions fractions :: operator+(fractions f)
{
fractions temp;
temp.denominator = denominator
f.denominator;
temp.numerator = numerator f.denominator + denominator f.numerator;
return temp;
}
//method to subtract two fractions
fractions fractions :: subFraction(fractions f)
{
fractions temp;
temp.denominator = denominator f.denominator;
temp.numerator = numerator
f.denominator - denominator f.numerator;
return temp;
}
//method to subtract two fractions
fractions fractions :: operator-(fractions f)
{
fractions temp;
temp.denominator = denominator
f.denominator;
temp.numerator = numerator f.denominator - denominator f.numerator;
return temp;
}
//method to multiply two fractions
fractions fractions :: multiFraction(fractions f)
{
fractions temp;
temp.denominator = denominator f.denominator;
temp.numerator = numerator
f.denominator denominator f.numerator;
return temp;
}
//method to multiply two fractions
fractions fractions :: operator(fractions f)
{
fractions temp;
temp.denominator = denominator
f.denominator;
temp.numerator = numerator f.denominator denominator * f.numerator;
return temp;
}
//method to divide to ...

I have add the two functions the add and subtract I have to now add the multiply and divsion functions can someone help

Ancient Dragon commented: This is not a code snippet, but a normal c++ question. -5

I see how the boolean function works now thanks a lot for your help I really appreciate it.

I have added the boolean function but cannot get it to print out whether or not its true or false it still just prints out the whats in the magic square.
[CODE]#include<iostream>
using namespace std;

include<fstream>

//load the array
void load2D(int &n, int square[50][50])
{
ifstream infile;
infile.open("magic.dat");
infile >>n;
for (int i =0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
infile >>square[i][j];
}
}
}

//Print the 2 dimensional arrray
void print2D(int n, int square[50][50])
{

for (int i =0; i < n; i++)
{
    for (int j = 0; j < n; j++)
    {
        cout <<square[i][j]<<" ";
    }
    cout <<endl;
}

}
//Determines if it is a magic sqaure
bool isMagic(int n, int square[50][50])
{
if (n == square[50][50])
return true;
else
return false;
}

int main()
{
int n;
int square[50][50];
load2D(n, square);
print2D(n,square);
isMagic(n, square);

system("pause");
return 0;
}
[/CODE]

I have finished all the functions except one. I need help with writing a boolean function to determine if the magic square is a magic square. I don't completely understand boolean functions so any help would be appreciated.

Thank you[code]#include<iostream>
using namespace std;

include<fstream>

//load the array
void load2D(int &n, int square[50][50])
{
ifstream infile;
infile.open("magic.dat");
infile >>n;
for (int i =0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
infile >>square[i][j];
}
}
}

//Print the 2 dimensional arrray
void print2D(int n, int square[50][50])
{

for (int i =0; i < n; i++)
{
    for (int j = 0; j < n; j++)
    {
        cout <<square[i][j]<<" ";
    }
    cout <<endl;
}

}

int main()
{
int n;
int square[50][50];
load2D(n, square);
print2D(n,square);
system("pause");
return 0;
}
[/code]

I completed most of the functions and it compiles but need help with two.Can someone help me with the uniqueScore function which is suppose to print test scores that only appears once and the differenceScore function which is suppose to print the difference between the largest and smallest score.

#include <iostream>
using namespace std;
#include <fstream>
void loadArray ( int intscores[], int numScores );
void printScores ( int intscores[], int numScores);
void computeAverage ( int scores, int numScores, double & average);
void greaterAverage ( int intscores [], int numScores, double & average);
void uniqueScores ( int scores, int numScores);
void largestScore ( int intscores[], int numScores, double largest);
void smallestScore ( int intscores[], int numScores, double smallest);
void differenceScore ( int scores, int numScores);

int main ()
{
    //declare variables
    int scores;
    int numScores;
    double largest;
    double smallest;
    double average;

}

//loads data from file
void loadArray(int intscores[], int size)
{
     ifstream infile;
     infile.open("scores.dat");
     size=0;
     while (!infile.eof() )
     {
           infile >> intscores[size];
           size++;
     }
     infile.close();

}
//prints scores 
 void printScores (int intscores[], int numScores)
{
      cout << "printing scores" <<endl;
      for (int i = 0; i < numScores; i++)
      cout << intscores[i] <<endl;
} 
//computes the average   
void computeAverage ( int scores, int numScores, double & average)
{
     average = (scores)/numScores;
}
//prints all scores greater than the average
void greaterAverage (int intscores[], int numScores, double & average)
{
     cout << "printing scores greater than the average score" <<endl;
     for (int i = 0; i < numScores; i++)
     if (intscores[i] ...

Do you think that the design of operating systems based on providing support for multimedia applications or access to the Internet has resulted in increased security risks? Why or why not? Discuss some security measures that would be taken to protect hardware and software.

I have started the program but I need help with createing a class which works for both integers and characters.
[code]

template< class T >

class List

{

private:

            struct node

            {

                            T data;

                            node * next;

            } 

            node * head, * tail;

            int size;

public:

            List();

            void Push_Head ( T item ); // inserts first

            void Push_Tail ( T item ); //inserts last

            T Head(); // returns the first node

            T Tail(); // returns the last node                 

            void Pop_Head(); //removes the first node

            void Pop_Tail(); //removes the last node

            int Length();

};

List<int> intList;

List<char> charList;
[/code]