Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » BeginnersRSS Feeds

Program to print table of values of the function y = e raise to -x

Posted By: Easy Tutor     Category: C++ Programming     Views: 5803

Write a program to print a table of values of the function.

y=e raise to -x

for x varying from 0 to 10 in steps of 0.1. the table should appear as follows.

Code for Program to print table of values of the function y = e raise to -x in C++ Programming

/*www.DailyFreeCode.comDownload Projects, Sourcecodes, Tips and Tricks, Interview FAQs, Hotlinks and more....Logon to www.DailyFreeCode.com*///write a program to print a table of values of the function.//y=e raise to -x//for x varying from 0 to 10 in steps of 0.1. the table should appear as follows.

#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
#include <math.h>

class exponent
{
float i,j;
public:
exponent()
{i=0;j=0.0;}
void display(void);
};

void exponent :: display(void)
{
double sum;
    cout<<"\n\n\t\t\tTABLE FOR Y = EXP[-X]\n";
    for(int a=0;a<40;a++)
        cout<<"--";
    cout<<"\n";
    for(int c=0,b=0.0;c<10;b++,c++)
    {
        if(b==0.0)
        cout<<setw(c+5)<<"X";
        else
        cout<<setw(c+3)<<b;
    }
    cout<<endl;
    for(int d=0;d<40;d++)
         cout<<"==";
    cout<<endl;
c=0;
    while(i<10)
    {
        while(c<10)
        {
            sum=1/pow(i,j);
            if(c==0)
               cout<<setw(5)<<i;
            else
               cout<<setw(3)<<sum;
            if(c>10)
            break;
        }
    cout<<endl;
    }
}

void main()
{
clrscr();
exponent o1;
o1.display();
getch();
}
  
Share: 



Easy Tutor
Easy Tutor author of Program to print table of values of the function y = e raise to -x is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!