HOME

CS 2511

CS 3810

CS 4600

CS 5610

CS 4600
STUDENT WEBPAGES
CS 4600
ASSIGNMENTS
CS 4600
TEST REVIEW
CS 4600
CLASS NOTES

CS 4600 ASSIGNMENTS

Assignment 1: Search program using Structure

Assignment 2: Search program using Class

Assignment 3: Make a Webpage using all of the 10 commandments (first draft)

Assignment 4: Search program using javascript

Assignment 5: Webpage with javascript and the 10 commandments

Examples of Javascript - How to Add
Examples of Javascript: How to input #'s to add Examples of Html (Links within the same File):
Example for 10 Commandments CGI - Under Construction:
Javascript Search Java Servlets


ASSIGNMENT 1: SEARCH PROGRAM USING STRUCTURE

#include <fstream.h>
#include<iomanip.h>
#include<string.h>
#include<stdlib.h>
struct student{
char personname[20][20];
char phone[20][20];
int counter;
};

int counter = 0;
myappend(student &info)
{
cout<<"ENTER PERSON NAME ";
cin>> info.personname[counter];
cout<<"ENTER THE PHONE ";
cin>> info.phone[counter];
counter++;
cout<<"COUNTER IS "<<counter<<endl;
return 0; }//MY APPEND
mysearch(student &info)
{
char searchname[20];
cout<<"ENTER THE SEARCH NAME ";
cin>>searchname;
for(int i = 0; i<counter;i++){
if(strcmp(searchname,info.personname[i])==0){
cout<<"THE PHONE IS "<<info.phone[i] << endl << endl;
cout<<"COUNTER IS "<<counter<<endl;
return 1; }//IF
}//wfor
cout<<"NAME NOT FOUND" <<endl;
return 0;
}//MYSEARCH
 
mydisplay(student &info)
{
for(int i= 0; i<counter;i++){
cout<<"Person Name Is "<< info.personname[i]<<endl;
cout<<"PHONE IS "<<info.phone[i]<<endl; }//while
return 0;
} //mydisplay
mymodify(student &info)
{
char searchname[20], newphone[20];
cout<<"ENTER A NAME TO MODIFY THE PHONE# "<<endl;
cin>>searchname;
for (int i=0; i<counter; i++)
{
if(strcmp(searchname,info.personname[i])==0){
cout<<"ENTER THE NEW PHONE NUMBER FOR THIS PERSON "<<endl;
cin>>newphone;
strcpy(info.phone[i], newphone);
return 1;
}//endif
cout<<"NAME NOT FOUND "<<endl;}
return 0;}
mydelete(student &info){
char searchname[20];
cout<<"ENTER THE DELETE NAME "<<endl;
cin>>searchname;
for(int i = 0; i<counter; i++){
if(strcmp(searchname, info.personname[i])==0){
strcpy(info.personname[i],"");
strcpy(info.phone[i],"");
return 1;}
}
cout<<"NAME NOT FOUND"<<endl<<endl;
return 0;
}//mydelete
int loadintoarray(student &info){
ifstream fin("directory.txt");
while(fin>>info.personname[counter]>>info.phone[counter])
counter++;
fin.close();
return 0;}//loadintoarray
int storetofile(student &info){
ofstream fout("directory.txt",ios::out);

for(int i = 0; i<counter; i++){

fout<<setw(20)<<info.personname[i]<<setw(20)<<info.phone[i]<<endl;

return 0;}

main()
{
student info;
char option;
//char personname[20][20],phone[20][20];
loadintoarray(info);
cout<<"SELECT ONE OF THE FOLLOWING"<<endl;
while(1){
cout<<"TYPE 1 TO INSERT "<<endl;
cout<<"type 2 to display "<<endl;
cout<<"type 3 to search " << endl;
cout<<"TYPE 4 TO MODIFY " <<endl;
cout<<"TYPE 5 TO DELETE " <<endl;
cout<<"type # to quit "<<endl;
cin>>option;
if(option=='1') myappend(info);
else if (option=='2') mydisplay(info);
else if (option=='3') mysearch (info);
else if (option=='4') mymodify (info);
else if (option=='5') mydelete (info);
else if(option=='#') {
storetofile(info);
cout<<"BYE"<<endl;
exit(1);
}
}//while
return 0;
}//ENDMAIN

BACK TO THE MENU

 

ASSIGNMENT 2: SEARCH PROGRAM USING CLASS

#include <fstream.h>

#include<iomanip.h>

#include<string.h>

#include<stdlib.h>

 

class student

{

private:char personname[20][20];

char phone[20][20];

int counter;

public: student ()

{

counter = 0;

}

int myappend();

int mysearch();

int mydisplay();

};

 

main()

{

student info;

char option;

int counter = 0;

cout<<"SELECT ONE OF THE FOLLOWING"<<endl;

while(1){

cout<<"TYPE 1 TO INSERT "<<endl;

cout<<"type 2 to display "<<endl;

cout<<"type 3 to search " << endl;

cout<<"type # to quit "<<endl;

cin>>option;

if(option=='1') info.myappend();

else if (option=='2') info.mydisplay();

else if (option=='3') info.mysearch ();

else if(option=='#') {cout<<"BYE"<<endl;

exit(1);

}

}//while

return 0;

}//main

 

int student:: myappend()

{

cout<<"ENTER PERSON NAME ";

cin>> personname[counter];

cout<<"ENTER THE PHONE ";

cin>> phone[counter];

counter++;

cout<<"COUNTER IS "<<counter<<endl;

return 0; }//MY APPEND

 

int student::mysearch()

{

char searchname[20];

cout<<"ENTER THE SEARCH NAME ";

cin>>searchname;

for(int i = 0; i<counter;i++){

if(strcmp(searchname,personname[i])==0){

cout<<"THE PHONE IS "<<phone[i] << endl << endl;

cout<<"COUNTER IS "<<counter<<endl;

return 1; }//IF

}//wfor

cout<<"NAME NOT FOUND" <<endl;

return 0;

}//MYSEARCH

 

int student::mydisplay()

{

for(int i= 0; i<counter;i++){

cout<<"Person Name Is "<<personname[i]<<endl;

cout<<"PHONE IS "<<phone[i]<<endl; }//while

return 0;

} //mydisplay

BACK TO THE MENU

ASSIGNMENT 3

CLICK ON THIS WEBSITE
TEN COMMANDMENTS

 

 



BACK TO THE MENU

ASSIGNMENT 4

BACK TOTHE MENU

 

 

 

ASSIGNMENT 5

 

 

 

 

 

 

BACK TOTHE MENU

JAVASCRIPT EXAMPLES

CLICK ON THIS WEBSITE
HOW TO ADD

 

BACK TO THE MENU

JAVASCRIPT EXAMPLES

CLICK ON THIS WEBSITE
INPUT #'S TO ADD

BACK TO THE MENU

EXAMPLE OF A LINK

CLICK ON THIS WEBSITE
Internal Link

BACK TO THE MENU

EXAMPLE FOR 10 COMMANDMENTS

CLICK ON THIS WEBSITE
10 COMMANDENTS

BACK TO THE MENU

SIMPLE CGI

CLICK ON THIS WEBSITE
TO SEE CGI CODE

BACK TO THE MENU

Javascript Search

CLICK ON THIS WEBSITE
JavaScript Search

BACK TO THE MENU

Java Servlet

CLICK ON THIS WEBSITE
Java Servlet Java Program

BACK TO THE MENU


(This is the end of the page.)

1