Fill in Order Details

  • Submit paper details for free using our simple order form

Make Payment Securely

  • Add funds to your account. There are no upfront payments. The writer will only be paid once you have approved your paper

Writing Process

  • The best qualified expert writer is assigned to work on your order
  • Your paper is written to standard and delivered as per your instructions

Download your paper

  • Download the completed paper from your online account or your email
  • You can request a plagiarism and quality report along with your paper

Mathematics

1. Assume that the aIDress of b[0] is 5200 in memory. What output would be produced by the following program (if the output is an aIDress, you need to write out the exact aIDress. For example, the aIDress of b[1] is 5214)?
#include <iostream>
using std::cout;
using std::endl;
int main()
{
int b[] = {3,4,2,5,6,7};
int *xPtr;
xPtr = &b[2];
cout << xPtr << endl;

cout << *xPtr << endl;

cout << &b[3] << endl;

cout << b[4] << endl;
*xPtr = 9;
cout << *xPtr << endl;
return 0;
}

2 What is the output of the following program? Explain how the function leftShift shown below works and why we need the variable temp? (Hint: if you don’t understand what the program do, please run it and print out what the value of temp when the function is called).

#include <iostream>
using namespace std;
void leftShift(int *);

int main()
{
int a[] = {3, 6, 7, 9, 4, 5, 2, 4, 2, 1};
for (int i = 1; i < 5; i++)
{
cout << “Step “ << i << “:n”;
leftShift(a);
}

return 0;
}
void leftShift(int *array)
{
int temp = *array;
for (int i = 0; i < 9; i++)
*(array+i) = *(array+i+1);
*(array+9) = temp;
for (int i = 0; i<10; i++)
cout << *(array+i) << ” “;
cout << endl;
}

3 Given the following definitions and assignments, what do these expressions evaluate to (assume each of the following problems is independent).
int a[] = {2, 4, 0, 3, 5, 9, 12, 6}, n;
int *aPtr = &a[3];

(a) n = *aPtr + 1; n = _____________

(b) n = *(aPtr + 2); n = _____________

(c) n = *(aPtr – 2); n = _____________

(d) n = *(++aPtr); n = _____________

(e) n = –(*aPtr); n =______________

(f) n = a[++(*aPtr )]; n =______________

4 Point out whether each of the following program segments is valid or invalid. If it is invalid, explain why. Assume the following declarations:
double a = 8.1, b = 2.5;
const double *aPtr = &a;
double * const bPtr = &b;

(a) *aPtr = &b;

(b) *aPtr = 6.5;

(c) aPtr = &b;

(d) aPtr = b;

(e) *bPtr = 3.4;

(f) bPtr = &a;

5 What is the output by the following program segment?
char x[ ] = “Today is a nice day ”;
char y[50], z[50];
strcpy(y, x);
cout << “The string x is: “ << x
<< “nThe string y is: “ << y << endl;
strncpy(z, x, 9);
z[9] = ‘?’;
cout << “The string z is: “ << z;
strcat(z, y);
cout << “nThe string z is: “ << z
<< “nThe length of z is: “ << strlen(z) << endl;

6 Given the class definition:
class Grade
{
public:
void setGrade(int r)
{
result = r;
}
int getGrade()
{
return result;
}
void printGrade()
{
cout << “Your result is” << result << endl;
}
private:
int result;
};
Write a main program to perform three tasks: (a) declare an object; (b) assign a value to the data member; (c) output the value.

Programming (hand in C++ code only)

7 Write a function that accepts a pointer to a string as an argument and returns the number of words contained in the string, that is, the function prototype is
int wordCount(char *);
If the string argument is “it is a nice day” the function should return 5. Demonstrate the function in a program that asks the user to input a string and then passes it to the function. (Hint: you need to use cin.getline() to receive the input string). The sample output is:
Enter a sentence: it is a nice day
The sentence has 5 words.
Don’t use strtok function. You can assume that the sentence has no empty spaces at the beginning and at the end.

8 Write a program to prompt user to enter a password. A valid password must have at least 6 characters and must consist of at least one lower character (ASCII code 97-122), one capital character (ASCII code 65-90) and one digital number (ASCII code 49-57). If the user enter a password shorter than 6 characters, or no capital or lower or special character, output the error message and let the user try again. Then let the user enter the password again to verify whether the user has remembered the password. If the two entered passwords are not the same, output error message and try again. If verification is OK, output “Your password is: password”. Use do-while, break and continue to make your code efficient.
Sample output:
Enter your password (e to exit): abcd
Password must be at least six characters! Try again.
Enter your password (e to exit): abcdef
Password must be one lower or capital or digital number! Try again
Enter your password (e to exit): Abcde7
Re-enter your password: abcde7
Two passwords are different. Try again.
Enter your password (e to exit): Abcde7
Re-enter your password: Abcde7
Your password is: Abcde7

9 Define a class called Point which consists two private data x and y with double type and three public member functions: a constructor Point(), void setPoint(double, double), void printPoint(). In the function setPoint, you need to verify if the values of x and y are located between 0 and100. If not set the value to be 0.0. In the printPoint(), print the following message:
(x, y) = (XXX.X, XX.X)
where X is a digit. In your main program, use keyboard to input the values of x and y (one time is OK). Then call setPoint() and printPoint().

&nbsp;

&nbsp;

WHAT OUR CURRENT CUSTOMERS SAY

  • Google
  • Sitejabber
  • Trustpilot
Zahraa S
Zahraa S
Absolutely spot on. I have had the best experience with Elite Academic Research and all my work have scored highly. Thank you for your professionalism and using expert writers with vast and outstanding knowledge in their fields. I highly recommend any day and time.
Stuart L
Stuart L
Thanks for keeping me sane for getting everything out of the way, I’ve been stuck working more than full time and balancing the rest but I’m glad you’ve been ensuring my school work is taken care of. I'll recommend Elite Academic Research to anyone who seeks quality academic help, thank you so much!
Mindi D
Mindi D
Brilliant writers and awesome support team. You can tell by the depth of research and the quality of work delivered that the writers care deeply about delivering that perfect grade.
Samuel Y
Samuel Y
I really appreciate the work all your amazing writers do to ensure that my papers are always delivered on time and always of the highest quality. I was at a crossroads last semester and I almost dropped out of school because of the many issues that were bombarding but I am glad a friend referred me to you guys. You came up big for me and continue to do so. I just wish I knew about your services earlier.
Cindy L
Cindy L
You can't fault the paper quality and speed of delivery. I have been using these guys for the past 3 years and I not even once have they ever failed me. They deliver properly researched papers way ahead of time. Each time I think I have had the best their professional writers surprise me with even better quality work. Elite Academic Research is a true Gem among essay writing companies.
Got an A and plagiarism percent was less than 10%! Thanks!

ORDER NOW

CategoriesUncategorized

Consider Your Assignments Done

“All my friends and I are getting help from eliteacademicresearch. It’s every college student’s best kept secret!”

Jermaine Byrant
BSN

“I was apprehensive at first. But I must say it was a great experience and well worth the price. I got an A!”

Nicole Johnson
Finance & Economics

Our Top Experts

See Why Our Clients Hire Us Again And Again!


OVER

10.3k
Reviews

RATING
4.89/5
Average

YEARS
13
Mastery

Success Guarantee

When you order form the best, some of your greatest problems as a student are solved!

Reliable

Professional

Affordable

Quick

Using this writing service is legal and is not prohibited by any law, university or college policies. Services of Elite Academic Research are provided for research and study purposes only with the intent to help students improve their writing and academic experience. We do not condone or encourage cheating, academic dishonesty, or any form of plagiarism. Our original, plagiarism-free, zero-AI expert samples should only be used as references. It is your responsibility to cite any outside sources appropriately. This service will be useful for students looking for quick, reliable, and efficient online class-help on a variety of topics.