Mobin_Teymoori's blog

By Mobin_Teymoori, 10 years ago, In English

How to write a program to show a line by line equation ?

Hello , everybody . I have a question and that is how to write a program in c++ , Qbasic or visual basic to input a line equation and the program outputs the line shape ?

  • Vote: I like it
  • -9
  • Vote: I do not like it

| Write comment?
»
10 years ago, # |
Rev. 3   Vote: I like it +3 Vote: I do not like it

//input for y = mx + c -> m and c

double m; //slope

double c; //y intercept

cin >> m >> c;

for(int x=-1000; x<=1000; x++){

double y = m*x + c;

plot(x, y); //assumed plot plots (x, y) point

}