#include "bits/stdc++.h"
using namespace std;
class data{
vector<string> discipline(3);
vector<int> no(3);
vector<string> title;
public:
void intro(){
cout<<"course listing and searching";
}
void fillCourses(){
cout<<"enter the courses"<<endl;
for(int i=0;i<3;i++)
{
cout<<" discipline:"<<endl;
cin>>discipline[i];
cout<<"course number:"<<endl;
cin>>no[i];
cout<<"course title:"<<endl;
cin>>title[i];
}
}
int courseSearch(){
string t;
cin>>t;
for(int i=0;i<no.size;i++){
if(title[i].compare(t)==0)
break;
}
if(title[i].compare(t)!=0)
return -1;
return i;
}
void showCourses(){
cout<<"All courses";
for(int i=0;i<no.size();i++){
cout<<discipline[i]<<" "<<no[i]<<" "<<title[i]<<endl;
}
}
void showOneCourse(){
string t;
cin>>t;
for(int i=0;i<no.size;i++){
if(title[i].compare(t)==0)
break;
}
cout<<"that course is"<<disciline[i]<<" "<<no[i]<<endl;
}
}
int main(){
data d;
d.fillCourses();
d.showCourses();
return 0;
}
c++ cout and cin 2. Write a program that uses parallel arrays to keep track of...
Debug and fix the Java console application that uses 2 dimensional arrays but the application does not compile nor execute. Student enters only integers to select courses for registration from a menu. No data type validation of the user menu selection is checked or required. The program terminates only when the student closes it. No registration of other courses not displayed by the program . No registration more than once for the same course. No registration for more than 9...
In C++
Write a menu driven C++ program to read a file containing
information for a list of Students, process the data, then present
a menu to the user, and at the end print a final report shown
below. You may(should) use the structures you developed for the
previous assignment to make it easier to complete this assignment,
but it is not required.
Required Menu Operations are:
Read Students’ data from a file to update the list (refer to
sample...
write C code that uses pointers, arrays, and C strings. 3. Write a function called pow_xy. The function should be passed 2 parameters, as illustrated in the prototype below. int pow_xy(int *xptr, int y); Assuming that xptr contains the address of variable x, pow_xy should compute x to the y power, and store the result as the new value of x. The function should also return the result. Do not use the built-in C function pow. For the remaining problems,...
Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839. Also, review pointers and dynamic memory allocation posted here under Pages. For sorting, you can refer to the textbook for Co Sci 839 or google "C++ sort functions". I've also included under files, a sample C++ source file named sort_binsearch.cpp which gives an example of both sorting and binary search. The Bubble sort is the simplest. For binary search too, you can refer to...
Develop a system flowchart and then write a menu-driven C++ program that uses user-defined functions arrays, and a random number generator. Upon program execution, the screen will be cleared and the menu shown below will appear at the top of the screen and centered. The menu items are explained below. Help Smallest Quit H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide the user...
Writing 3 Java Classes for Student registration /** * A class which maintains basic information about an academic course. */ public class Course { /** * Attributes. */ private String code; private String title; private String dept; // name of department offering the course private int credits; /** * Constructor. */ public Course(String code, String title, int credits) { // TODO : initialize instance variables, use the static method defined in // Registrar to initialize the dept name variable...
Write a C++ program to validate computer user-ids and passwords. A list of valid ids and passwords (unsorted) is read from a file and stored in a Binary Search Tree (BST) of UserInfo objects. When user-ids and passwords are entered during execution, this BST is searched to determine whether they are legal. Input (file): UserInfo records for valid users Input (keyboard): Ids and passwords of users logging in Output (screen): Messages indicating whether user-ids and passwords are valid, as well...
I
wrote this code but there’s an issue with it :
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
class Borrower {
private:
string ID, name;
public:
Borrower() :ID("0"), name("no name yet") {}
void setID(string nID);
void setName(string nID);
string getID();
string getName();
};
void Borrower::setID(string nID) {
ID = nID;
}
void Borrower::setName(string nname) {
name = nname;
}
string Borrower::getID() {
return ID;
}
string Borrower::getName() {
return name;
}
class Book {
private:
string...
In the C++ programming language write a program capable of playing 3D Tic-Tac-Toe against the user. Your program should use OOP concepts in its design. Use Inheritance to create a derived class from your Lab #9 Tic-Tac-Toe class. You can use ASCII art to generate and display the 3x3x3 playing board. The program should randomly decide who goes first computer or user. Your program should know and inform the user if an illegal move was made (cell already occupied). The...
The purpose of this assignment is to develop solutions that perform File IO and objects. Problem specifications are shown below with my changes in blue. 1. File Previewer Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been...