Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a c++ program: 1) Read a series of integers and determine the following in

ID: 3624237 • Letter: W

Question

Write a c++ program:

1) Read a series of integers and determine the following information about each integer:
a. Is it a multiple of 7, 11 or 13?
b. Is the sum of the digits odd or even?
c. What is the square root value (if positive)?
d. Is it a prime number?
You should have at least four functions and label all output.
Use the following sample input data:
104
3773
13
121
77
30751
You should read the data from file.
2) Write a program that reads several lines from a data file and prints each word of the
file on a separate line of an output file followed by the number of letters in that word.
Also print a count of words in the file on the screen when done. Assume that words are
separated by one or more blanks.
Use at least two functions.
Use the following as your sample input data:
Write a program that reads several lines from a data file and prints each word of the
file on a separate line of an output file followed by the number of letters in that word.
Also print a count of words in the file on the screen when done. Assume that words are
separated by one or more blanks.
Sample output:
Write 5
a 1
program 7
The total number of words is 59
3) An integer number is said to be a perfect number if the sum of its factors, including 1
(but not the number itself), is equal to the number. For example,6 is a perfect number,
because 6 = 1 + 2 + 3. Write a function PERFECT that determines whether parameter N is a
perfect number. Use this function in a program that determines and prints all the perfect
numbers between 1 and 1000. Print the factors of each perfect number to confirm that the
number is indeed perfect. Challenge the power of your computer by testing numbers much
larger than 1000.
int IsFactor(int number, int divisor)
{
if (number% divisor == 0)
return 1;
else
return0;
}
cin >> N;
for (int i = 1; i < N; i++)
4) Write a function that displays the left margin of the screen a solid square of a
character whose side is specified in integer parameter side. For example if the
character is ‘*’ and side is 4, the function displays
****
****
****
****
void display (char ch, int side)
{
}

Explanation / Answer

please rate - thanks

#include<iostream>
using namespace std;
void isPerfect(int);
int main()
{int num;
cout<<"The perfect numbers between 1 and 1000 are: ";
for(num=1;num<=1000;num++)
{isPerfect(num);
}

system("pause");
return 0;
}
void isPerfect(int num)
{int sum,i,count=0;
count=0;
sum=0;
for(i=1;i<num;i++)
    if(num%i==0)
        {sum+=i;
        count++;
        }
if(sum==num)
     {
     cout<<num<<" = ";
         for(i=1;i<num;i++)
            if(num%i==0)
                 {count--;
                  cout<<i;
                  if(count>0)
                      cout<<" + ";
                      }
          cout<<endl;
          }
}

----------------------------------------

#include <iostream>
using namespace std;
void display (char ch, int side)
{int i,j;
for(i=0;i<side;i++)
   {for(j=0;j<side;j++)
      cout<<ch;
   cout<<endl;
   }
}
int main()
{int side;
char ch;
cout<<"Enter the size of the square: ";
cin>> side;
cout<<"Enter the character to print: ";
cin>>ch;
display(ch,side);
system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote