C++ Homework Help, Project Help, C++ Assignment Solution

If you need professionally completed C++ assignments, then you’re in luck. I’ve had to do 6 copies of the same assignment (due to student referral, that was hard since each to be written from scratch without repeating anything. I even changed the algorithms, not just variable names and functions, this was a total rewrite). So don’t worry about getting a copy that your friend has, this will be custom and will pass any cheat detector.

C++ is based on C, but adds classes (it was originally called C with classes) as well as other features such
as operator overloading, templates, overloaded methods.

Guaranteed 100% plagiarism free answers to your C++ problems.

C++ is a general purpose, statically typed, compiled, free-form and case-sensitive programming language.  We at ProgrammingHomeworkHelp provide various programming assignment solutions and C++ is one of them. C++ programming is based on the concepts of object-oriented programming. C++ is regarded as a middle-level language. We provide help with C++ programming homework to students so that they understand this as a combination of high and low level language features. C++ was invented in 1979 by Bjarne Stroustrup at Bell Labs, as an enhancement to the C language. It was originally named as C with Classes but later renamed as C++ in 1983. Our expert tutors offer round the clock help with C++ homework to students and professionals. Our C++ programming assignment help consists of simple as well as complex codes with respect to the difficulty level of the assignment given.

Example:

Write a program that checks a user’s age

  1. If the user is 18 to 20 print “Here’s a wristband”
  2. If the user is younger than 18 then print “Please Leave
  3. Else Welcome the user

 

club.cpp

#include <iostream>
using namespace std;

int main() {
    int age;

    cout << "Enter age: ";
    cin >> age;

    if (age >= 18 && age <= 20) {
        cout << "Here's a wristband" << endl;
    } else if (age < 18) {
        cout << "Please Leave" << endl;
    } else {
        cout << "Welcome you" << endl;
    }
}

Guaranteed 100% plagiarism free answers to your C++ course work.

 

Example:

Write a number to convert a positive fractional decimal number (a number between 0 and 1, exclusive) to an
equivalent number in any radix using successive multiplication method. We illustrate the method of
converting a decimal number to a binary number using 0.8125 as an example.

  1. Multiply 0.8125 by 2, the first product carries into the unit place.
  2. Ignore the value in the units place at each step, continue multiplying the fractional part.
  3. You are finished when the fractional is 0, or until you have reached the desired number of
    decimal places.
  4. 0.812510 = 0.11012

The process is shown below

 0.8125
 x    2
-------
1.6250

 0.6250
 x    2
-------
1.2500

 0.2500
 x    2
-------
0.5000

 0.5000
 x    2
-------
1.0000

The method also works with any base, just replace the 2 with the target radix as the multiplier.

Implement the algorithm in C++. Use a queue to store the carries into the unit place. You
can use either static array based queue, dynamic memory based queue, or linked queue, with
necessary member functions. Please structure your programming according to the following
requirements.

  1. Your program should read the decimal fractional number and the target radix (betweem 2
    and 9, inclusive) from keyboard with proper prompting messages.
  2. Do successive multiplication and store carries into units place in the queue.
  3. Print the converted number in the target radix from the queue.
  4. Loop back to prompt the user to enter another number to convert. Exit when the user enters -1.

C++ supports object-oriented programming. It includes the four pillars of object-oriented development which are Polymorphism, Encapsulation, Inheritance and Abstraction. Standard C++ consists of three important parts, i.e the variables, data types and literals which stands as the building block to the entire code. The C++ Standard Library provides a well set of functions that manipulating files strings, etc.  The Standard Template Library is giving a wealthy set of methods in manipulating data structures, etc. We also offer online help with C++ programming homework so that students from across the world have access to it. Our experts are also available via email to provide help with C++ programming assignment, so that the queries are timely resolved. With C++ programming project help, we also explains the concepts of OOPs.

queue.h

// the queue class used to store the carries during the calculation
#ifndef __QUEUE_H
#define __QUEUE_H

// the maximal number of carries that is allowed during the calculation
// change to larger value if needed
#define SIZE 64

class queue {
  private:
    int carries[SIZE];
    int capacity;  // the capacity of this queue
    int size;      // the current number of numbers in this queue

  public:
    queue();
    ~queue();

    // getter functions
    int getSize();
    int getCapacity();
    // get the value at the given position
    int get(int i);

    // add the value to the end of the queue
    // if this queue is already full return false
    bool enqueue(int val);
};

#endif

 

queue.cpp

#include "queue.h"
#include <iostream>
#include <cmath>
using namespace std;

// implementation of queue class
queue::queue() : capacity (SIZE), size(0) {
}

queue::~queue() {
    // nothing to do here
}

int queue::getSize() {
    return size;
}

int queue::getCapacity() {
    return capacity;
}

int queue::get(int i) {
    if (i >= 0 && i < size) {
        return carries[i];
    }
    return 0;
}

bool queue::enqueue(int val) {
    if (size == capacity) { // the queue is already full
        return false;
    }
    carries[size ++] = val;
    return true;
}

queue convert(double value, int radix) {
    queue q;

    // loop until either value is 0 or
    //  the q is full already (reach the desired number of places)
    while (value > 0 && q.getSize() < q.getCapacity()) {
        value *= radix;

        // get the carry bits
        int carry = (int)floor(value);

        // put it into the queue
        q.enqueue(carry);

        // remove this carry bits from the value
        value -= carry;
    }

    return q;
}

// a main function that uses the queue to convert the numbers
int main() {
    double val;
    int radix;

    while (true) {
        // ask the user to input the value to convert
        // and the radix of the target number
        while (true) { // loop until user has input a valid value
            cout << "Enter the number (-1 to quit): ";
            cin >> val;
            if (val == -1) {
                // quit the program
                return 0;
            }
            if (val <= 0 || val >= 1) {
                cout << "Error: the number should be between 0 and 1, exclusive." << endl;
            } else {
                break;
            }
        }

        while (true) { // loop until user has input a valid radix
            cout << "Enter the target radix: ";
            cin >> radix;
            if (radix < 2 || radix > 9) {
                cout << "Error: the target radix should be between 2 and 9, inclusive." << endl;
            } else {
                break;
            }
        }

        // call the convert function to convert
        queue q = convert(val, radix);

        // display the result
        cout << "0.";
        for (int i = 0; i < q.getSize(); i++) {
            cout << q.get(i);
        }
        cout << endl;
    }
}

If you need help on your C++ assignment, then I can provide one. See the following example.

 

Example:

0.Introduction.
In this assignment you are required to develop a program that allows the
creation, viewing and storage of information about ITECH7603
Students. In order to complete the task you have to investigate how
to use the following STL(Standard Template Library) containers –
vector, set, and map.

The information about ITECH7603 students consists of: first name,
surname, and marks for Lab Test, Assignment1, Assignment2, and Final
Exam. This information should be stored in the binary file
“ITECH7603Students.bin”. The program should also calculate and
display the marks and grade for each student.

The following describes how to calculate the marks and grade:

Lab Test Mark – is an integer from 0 to 10;

Assignment1 Mark – is an integer from 0 to 20;

Assignment2 Mark – is an integer from 0 to 20;

Final exam Mark – is an integer from 0 to 50;

A total mark is a sum of the previous four marks, so it is an integer
from 0 to 100.

A student passes the course if and only if (Assignment1
Mark + Assignment2 Mark) >= 20 and (Lab Test Mark + Final Exam
Mark) >= 30

There are 5 grades, which are calculated according to the following rules:

F – if the Total Mark is less then 40;

MF – if (40 <= Total Mark < 50) or (Total Mark >= 50 but
student didn’t pass);

P – if (50 <= Total Mark < 60) and student passed;

C – if (60 <= Total Mark < 70) and student passed;

D – if (70 <= Total Mark < 80) and student passed;

HD – if Total Mark >= 80;

C++ supports a variety of programming styles. Our online C++ programming assignment experts help students to write codes in C++ programming language in such a way that they can get hold of the body and logic effectively. Our C++ programming project help service is availed by hundreds of programmers, students and professionals as it is essential in every application domain. Device drivers that are highly used and other software relying on direct operation of hardware under real-time constraints. Our tutors provide C++ programming homework help from basic level to the advanced levels. Anyone who has used either an Apple Macintosh or a Windows PC has indirectly used C++as the primary user interfaces of these systems are written in C++.

1. Class Student (or ITECH7603Student).

Develop a Student class that has the following header file:

#ifndef STUDENT_H 
#define STUDENT_H 
#include <iostream> 
#include <iomanip> 
#include <string> 
using namespace std; 
class Student{ 
public: 
    Student(); 
    Student(string name,string surname,int a1, int a2, int test, int exam); 
    string getName()const; 
    string getSurname()const; 
    int getAssignment1Mark()const; 
    int getAssignment2Mark()const; 
    int getLabTestMark()const; 
    int getExamMark()const; 
    void setAssignment1Mark(int); 
    void setAssignment2Mark(int); 
    void setLabTestMark(int); 
    void setExamMark(int); 
    bool passed()const; 
    string getGrade()const; 
    friend ostream& operator<<(ostream& stream, const Student &); 
    bool operator<(const Student &)const; 
private: 
    string name; 
    string surname; 
    int assignment1Mark; 
    int assignment2Mark; 
    int labTestMark; 
    int examMark; 
}; 
#endif

You are required to implement the class, i.e. to develop the
implementation file “Student.cpp” that conforms to the following
specifications:

  1. The data fields have self explanatory identifiers, and their meaning
    should be clear from the Introduction.
  2. The “set” functions allow the user to set the assessment task
    marks within the specified margins, e.g. setExamMark ensures that the
    examMark is in the appropriate range – from 0 to 50.
  3. The function getGrade() returns the student’s grade, calculated as
    specified in the Introduction. The rest of the “get” functions
    simply return the values of the corresponding fields.
  4. The function passed() returns true if this student, has passed the course,
    and returns false otherwise (see the Introduction).
  5. friend ostream& operator<<(ostream& stream, const Student &)
    – the function overloads << operator, which allows a Student object
    information to be output in the following format:
Underwood
    Scott:

Assignment
    1 8 

Assignment
    2 16 

Lab
    Test 0 

Exam
    34 

Grade
    P
  1. bool operator<(const Student &student)const –
    the function overloads < operator, which allows to compare
    student’s full names lexicographically.

2. Class ITECH7603Class.

The class has the following header file. Objects of this _class
_represent ITECH7603 teaching classes (student groups).

#ifndef ITECH7603CLASS_H 
#define ITECH7603CLASS_H 
#include "Student.h" 
#include <set> 
#include <map> 
#include <fstream> 
class ITECH7603Class{ 
public:
    ITECH7603Class(); 
    ITECH7603Class(int dummy); 
    ITECH7603Class(set<Student>*); 
    ~ITECH7603Class(); 
    void addStudent(Student*); 
    map<string,Student>* getGroup(); 
    void save(); 
private: 
    map<string,Student>* group; 
}; 
#endif

You are required to implement the class, i.e. to develop the
implementation file “ITECH7603Class.cpp” that conforms to the
following specifications:

  1. The only field of the class is a pointer to a “map<string,Student>”
    object representing a teaching group(or class), which is a map (an
    associative STL container) that contains the pairs:

Key: a student’s full name (i.e. name + ” ” + surname)

Value: corresponding Student object.

In this assignment you should assume that there are no different
students with identical full names in ITECH7603 teaching classes.

  • void addStudent(Student* studentPtr)- the function adds the pairKey: (*studentPtr) student’s full nameValue: (*studentPtr)To the (*group) map;Please note that instead of actual objects you are supposed to use pointers
    as function parameters.
  • void save()- the function writes the Student objects stored as values in the (*group)
    map to the “ITECH7603Students.bin” file. “ITECH7603Students.bin”
    is a binary file, and you are required to write the objects to the
    file using something like

 

out.write(reinterpret_cast<char*>(s), sizeof(Student));

  • Constructor ITECH7603Class() and the destructor:A default constructor initializes dynamically the group field.The destructor deletes the group pointer.
  • Constructor ITECH7603Class(int dummy):This constructor does not require any parameter. However, to distinguish
    it from the default constructor you should use some dummy argument
    (say of int type).This constructor opens the “ITECH7603Students.bin” file, if such
    file exists, and reads information from the file into the (*group)
    map using addStudent() function. If the file “ITECH7603Students.bin”
    does not exist, the constructor behaves as the default constructor.
  • Constructor ITECH7603Class(set*students):This constructor takes a set of Student objects (in fact, a pointer to the
    set) as an argument and adds students from the set to the (*group)
    map, i.e. initializes the group field.

 

3. TestAssignment2.cpp

In this assignment you are provided with three input text files

associated with this program:

  • firstNamesBoys.txt – contains first names for boys
  • firstNamesGirls.txt – contains first names for girls
  • lastNames.txt – contains last names

Each of these input files contains one name per line. Hence
“firstNamesBoys.txt” will contain one boy’s name per line, and
“lastNames.txt” contains one surname per line. These input files
will be used to create a random set of Student objects to test your
application.

The test program should conform to the following specifications:

  1. There are three three global variables declared in the program:vector*names = new vector();vector*surnames = new vector();set*students = new set();
  2. The test program should define a function with the following
    prototype:

void readInputFiles();

This function does the following:

  • Opens and reads firstNamesBoys.txt. Each name should be read into a string
    and added to the vector* names.
  • Opens and reads firstNamesGirls.txt. Each name should be read into a string
    and added to the vector* names.
  • Opens and reads lastNames.txt. Each name should be read into a string and
    added to the vector* surnames.
  • The test program should define a function with the following
    prototype:void createRandomStudentSet(int n);This function creates Student objects choosing values for their fields
    randomly:
  • Value for first name is chosen randomly from the vector (*names).
  • Value for surname is chosen randomly from the vector (*surnames).
  • Values for the rest of fields are chosen randomly from the corresponding
    ranges, e.g. value for the examMark is a random value from 0 to 50.

If thus created Student object has passed the course it is added to the
(*students) set (an associative container from STL). You should
continue adding random Student objects to the set until the total
number of Student objects in the set is n.

  • The main function performs the following tasks:
    • Invokes consecutively functions readInputFiles(), createRandomStudentSet(12).
    • Then creates a ITECH7603Class object (or a pointer to the object) using
      the constructor ITECH7603Class(students), and saves it (to the file
      “ITECH7603Students.bin”).
    • Creates another ITECH7603Class object using the constructor with a “dummy”
      parameter and prints information of the Student objects from the
      (*group) map field of the class.

 

The following is a sample output of the test program (number of students is 5):

Adams
Tiana:

Assignment
1 17 

Assignment
2 5 

Lab
Test 4 

Exam
34 

Grade
C 

Barley
Tia: 

Assignment
1 9 

Assignment
2 19 

Lab
Test 5 

Exam
41 

Grade
D 

Cameron
Trent: 

Assignment
1 19 

Assignment
2 10 

Lab
Test 4 

Exam
41 

Grade
D 

Cannon
Isabel: 

Assignment
1 17 

Assignment
2 19 

Lab
Test 8 

Exam
25 

Grade
C 

Davis
Chelsea: 

Assignment
1 3 

Assignment
2 19 

Lab
Test 6 

Exam
40 

Grade
C

We have the database of repeat customers/students/professionals who seek help with C++ programming. Many of them have referred us to their friends and colleagues so that they can also take the advantage of our C++ programming assignment help. We take care of the basic fundamentals of programming language while we offer help with C++ programming homework to students.

main.cpp

#include<stdlib.h>
#include"ITECH7603CLASS_H.h"
#include "STUDENT_H.h"
#include<cstdlib>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
void readInputFiles();
void createRandomStudentSet(int n);
vector<string>* names = new vector<string>();
vector<string>* surnames = new vector<string>();
set<Student>* students = new set<Student>();
class ITECH7603Class *tech;

int main(int argc, char** argv) 
{

    tech=(ITECH7603Class*)malloc(sizeof(ITECH7603Class));

        readInputFiles();

        createRandomStudentSet(12);
    map<string,Student> *grop2=tech->getGroup();
        map<string, Student>::iterator ii=grop2->begin();
        while(ii!=grop2->end())
        {
            cout<<(*ii).second<<"\n";
            ii++;
        }

        return 0;

}
void readInputFiles()
{
    string name;
    ifstream file;
    file.open("c:\\firstNamesBoys.txt"); //give the path to your file
    vector<string>::iterator it;
    if(file.is_open())
    {

        //vector<string>::iterator it;
        it = names->begin();

        while(getline (file,name)) 
        {
            //getline(file,name) ;
            it = names->insert ( it , name );
            it++;
            //cout<<name<<"\n";
        }
        file.close();
    }
    else
        cout<"file not found";
    file.open("c:\\firstNamesGirls.txt"); //give the path to your file
    if(file.is_open())
    {

        while(getline (file,name)) 
        {
            //getline(file,name) ;
            it = names->insert ( it , name );
            it++;
            //cout<<name<<"\n";
        }
        file.close();
    }
    else
        cout<"file not found";

    file.open("c:\\lastNames.txt"); //give the path to your file
    if(file.is_open())
    {

        //vector<string>::iterator iit;
        it = surnames->begin();
        while(getline (file,name)) 
        {

            it = surnames->insert ( it , name );
            it++;

        }
        file.close();
    }
    else
        cout<"file not found";

}
void createRandomStudentSet(int n)
{
    int c, num1,num2,ass1Mark,ass2Mark,lab,exam;
     int max1=names->size();
     int max2=surnames->size();
    for ( c = 1 ; c <= n ; )
   {
      num1 = rand() % max1;
      num2 = rand() % max2;
      ass1Mark=rand() % 20;
      ass2Mark=rand() % 20;
      lab=rand() % 10;
      exam=rand() % 50;

      class Student student((*names)[num1],(*surnames)[num2],ass1Mark,ass2Mark,lab,exam);

      if(student.passed())
      {

          c++;
          students->insert(student);
          tech->addStudent(&student);
      }

   }

}

 

STUDENT_H.cpp

#include"STUDENT_H.h"
using namespace std;

//student()
//{
//
//}
Student::Student()
{

}
Student::Student(string names,string surnames,int a1, int a2, int test, int exam)
{
name=names;
surname=surnames;

assignment1Mark=a1;
assignment2Mark=a2;

We at ProgrammingHomeworkHelp, provide highly skilled and dedicated group of experts who help students in assignment solutions. We are available 24 x 7 to offer full time support. Students, who want to take help from us can to upload their assignment on our website. They can also send their assignment via email.