Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Alain de Callafon
Thursday, March 27th, 2008 at 9:36:14am MDT 

  1. //abc-formule( eerste programma)
  2.  
  3. #include <iostream>
  4. #include <math.h>
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9.         //declareren van variabelen
  10.         float a, a2, b, b2, b3, b4, c, D, sqrD, x, x1;
  11.  
  12.         //invoeren van variabelen
  13.         cout << "Voer variabele a in." << endl;
  14.         cin >> a;
  15.         cout << "Je hebt het getal: " << a << " ingevoerd" << endl;
  16.         cout << "Voer variabele b in." << endl;
  17.         cin >> b;
  18.         cout << "Je hebt het getal: " << b << " ingevoerd" << endl;
  19.         cout << "Voer variabele c in." << endl;
  20.         cin >> c;
  21.         cout << "Je hebt het getal: " << c << " ingevoerd" << endl;
  22.        
  23.         //berekenen van overige variabelen
  24.         a2 = 2*a;
  25.         b2 = b*b;
  26.         b3 = b-b2;
  27.         D = b2-4*a*c;
  28.         sqrD = sqrt (D);
  29.        
  30.         //berekenen van eindantwoord x
  31.         x = (b3-sqrD)/a2;
  32.         x1 = (b3+sqrD)/a2;
  33.        
  34.         //printen van de waarden van D en x
  35.         cout << "D = " << D << endl;
  36.                
  37.                 if (D < 0)
  38.                 cout << "x heeft geen oplossingen." << endl;
  39.                
  40.                 else if (D > 0)
  41.                 cout << "x = " << x << " of x = " << x1 << endl;
  42.                                
  43.                 else
  44.                 cout << "x = " << x << endl;
  45.        
  46.         return 0;1111111
  47. }

Paste Details

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right