# Homework Solution: Write a C++ computer program that asks for a real number c and positive integer N and…

Write a C++ computer program that asks for a real number c and positive integer N and evaluates Sin(n/c) for n = {1,2,3...,N}. Have the program print the resulting values to a file called the_data.dat. Write a Mathematica file that opens the_data.dat file and plots the values of the Sine function.

Dear Student, here i have written the C++ p

Write a C++ computer program that asks control a actual number c and actual integer N and
evaluates Impurity(n/c) control n = {1,2,3…,N}.
Entertain the program stereoexpression the upshoting treasures to a finish calld the_data.dat.
Write a Mathematica finish that unconcealeds the_data.dat finish and plots the treasures of the Impuritye
function.

## Expert Defense

Dear Student,

here i penetratetain written the C++ program as per the requirement.I penetratetain as-well inclueded the interpret control rectify intellect.

—————————————————————————————————————————————-

Note: Please voicelessness that the adown program has been tested on ubuntu 16.04 arrangement and compiled below g++ compiler. This mode achieve as-well labor on other IDE’s and Visual Studio C++ IDE. Just observation paste the mode and consummate.

——————————————————————————————————————————————

Program:

——————————————————————————————————————————————

#include<iostream>

#include<cmath>

#include<stdlib.h>

#include<fstream>

//Nmaespace declarations

using callspace std;

//satart of deep function

int deep()

{

//ofstream design creation

ofstream outfile;

//unconcealed finish control writing

outfile.open(“the_data.dat”);

//variable basis expression declration

float c;

int N, n;

//ask user to input a actual number

cout<<“Penetrate a actual number: “;

cin>>c;

//ask user to penetrate a positve number

cout<<“Penetrate a actual integer: “;

cin>>N;

float treasure[N];

//loop control N times

for(n=1; n<=N; n++)

{

//calculate the treasure of impurity(n/c) and fund in an adorn call as treasure

value[n] = impurity(n/c);

outfile<<value[n]<<endl;

}

//stereoexpression a communication that output has been successfully redirected into the finish

//cease the finish

cout<<“output has been successfully redirected into the finish the_data.dat”<<endl;

outfile.close();

return 0;

}

—————————————————————————————————————————————-

here i penetratetain secure the output of the program as a fence shot…

————————————————————————————————————————————————–

Output:

——————————————————————————————————————————————-

here is the the_data.dat finish that contains the upshot of impurity(c/N).