c++ code This assignment was locked Jul 10 at 6pm. You are to write a program th
ID: 3754370 • Letter: C
Question
c++ code
This assignment was locked Jul 10 at 6pm.
You are to write a program that will be used to look up the demographic information of a student.
Their are two files which I provide that contains the following information:
city.dat which contains the zipcode, population , and city (string)
city.dat
student.dat which contains student id, student name , student classification, student zipcode
student.dat
INPUT
1. You are to read both files into arrays.
2. The user will be prompted to enter the id of the student that they wish to look up.
PROCESSING
1. You are to search through the student array(s) looking for the student whose id matches the one entered by the user.
If successful, you will then attempt to look up their city demographic and ...
OUTPUT
1. ... display the data to the screen.
Below are test cases for you to use.
Example: 1
SADDLEBACK STUDENT DEMOGRAPHIC LOOK UP
ENTER STUDENT ID ("Q" to Quit program)
: liaoibls
STUDENT FOUND
NAME CLASSIFICATION CITY ZIPCODE POPULATION
============== ============== ===================== ======= ==========
Abreu Zorina Sophomore Aliso Viejo 92656 49046
The program would then pause, then after the user presses a key, clear the screen and prompt for another student all over again.
Example: 2
SADDLEBACK STUDENT DEMOGRAPHIC LOOK UP
ENTER STUDENT ID ("Q" to Quit program)
: vskyslv2
STUDENT DOES NOT EXIST IN OUR DATABASE.
The program would then pause, then after the user presses a key, clear the screen and prompt for another student all over again.
Example: 3
SADDLEBACK STUDENT DEMOGRAPHIC LOOK UP
ENTER STUDENT ID ("Q" to Quit program)
: f0hubu1x
STUDENT FOUND
ZIP CODE DOES NOT EXIST IN OUR DATABASE
NAME CLASSIFICATION CITY ZIPCODE POPULATION
============== ============== ===================== ======= ==========
Bagdat Ya-Han Junior **ERROR** 99999 **ERROR**
The program would then pause, then after the user presses a key, clear the screen and prompt for another student all over again.
FINALLY: After the user quits the program, you are to print out a student report that is sorted in alphabetic order by city prior to exiting the program that prints the same demographic information as above.
SUBMISSION REQUIREMENTS.
1. your exam1.cpp file (single file)
2. four screen screen shots, one for each run above and the final sorted report.
Explanation / Answer
#include #include #include class Cpu { public: virtual int dummy( int, int ) {} private: virtual int add_( int a, int b ) { return a + b; } /* A */ virtual int sub_( int a, int b ) { return a - b; } /* B */ virtual int mul_( int a, int b ) { return a * b; } /* C */ virtual int div_( int a, int b ) { return a / b; } /* D */ virtual int mod_( int a, int b ) { return a % b; } /* E */ virtual int and_( int a, int b ) { return a & b; } /* F */ virtual int or_( int a, int b ) { return a | b; } /* G */ virtual int xor_( int a, int b ) { return a ^ b; } /* H */ }; int main( int argc, char* argv[] ) { typedef int (Cpu::*Memfun)( int, int ); union { Memfun fn; unsigned char ptr[6]; } u; Cpu cpu; u.fn = &Cpu::dummy; assert( argc == 4 ); int p1 = atoi( argv[ 1 ] ); int p2 = atoi( argv[ 3 ] ); char op = argv[2][0]; assert( op >= 'A' && opRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.