Ako sam te dobro razumio, ti hoćeš da ti zadatak riješi i po drugoj formuli, ali rješenje ti je isto, ako si to htjeo, evo rješenja:
Code:
#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
//Definiranje ulaznih velicina
float focallength,nearlimit,farlimit,total,circleofconfusion;
float fstop,subjectdistance;
//Geometrijski i maseni podaci
cout << "Unesite F STOP:" << endl;
cin >> fstop;
cout << endl;
cout << "Unesite SUBJECT DISTANCE: s=" << endl;
cin >> subjectdistance;
cout << endl;
//konstante
circleofconfusion=0.019;
focallength=100;
//formula
farlimit = (subjectdistance* (((focallength*focallength)/(fstop*circleofconfusion))+focallength)-focallength)/(((focallength*focallength)/(fstop*circleofconfusion)+focallength)-subjectdistance);
cout << " Far limit je : ";
cout << farlimit;
cout << endl;
// *novi dio, za rjesavanje po drugoj formuli
cout<<endl;
float Dn, s, f, N, c;
s = subjectdistance;
N = fstop;
c = circleofconfusion;
f = focallength;
Dn = (s*(((f*f)/(N*c))+f)-f)/(((f*f)/(N*c)+f)-s);
cout<<"Rjesenje po drugoj formuli: "<<Dn<<endl<<endl;
// *kraj novog dijela
system ("PAUSE");
return 0;
}