The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C++ Code
Posted by: dalykas | November 17, 2010 @ 5:23am
C++ Code
[
Download
]
#include <iostream> // konsolinio darbo re�imo priemonės cin ir cout #include <iomanip> // manipuliatorių biblioteka #include <cmath> using namespace std; // naudojama std vardų erdvė const double eps = 0.001;// tikslumo konstanta skaičiavimams // su slankaus kablelio skaičiais // Funkcijų prototipai void ReiksmiuLentele (double a, double b, double cp, double cg, double ch, double iq, double iw); double ReiksmeY (double a, double b, double c, double x); double ReiksmeX (double a, double b, double c); int main() { double cp, // pradinė funkcijos argumento reik�mė cg, // galutinė funkcijos argumento reik�mė ch, // funkcijos argumento �ingsnis a, b, iq, iw; // Dialogas duomenų xpr, xgal ir hx įvedimui cout << "Programa darba pradejo" << endl; cout << "Iveskite a reiksme." << endl; cin >> a; cout << "Iveskite b reiksme." << endl; cin >> b; cout << "Iveskite pradine argumento reiksme." << endl; cin >> cp; cout << "Iveskite galutine argumento reiksme." << endl; cin >> cg; cout << "Iveskite zingsnio reiksme." << endl; cin >> ch; cout << "Iveskite intervalo q reiksme" << endl; cin >> iq; cout << "Iveskite intervalo w reiksme" << endl; cin >> iw; ReiksmiuLentele(a, b, cp, cg, ch, iq, iw); cout << "Programa darba baige." << endl; return 0; } // Funkcijos reik�mių spausdinimas lentele: // xp - pradinė reik�mė; // xg - galutinė reik�mė; // hx - �ingsnis void ReiksmiuLentele (double a, double b, double cp, double cg, double ch, double iq, double iw) { double c; cout << "----------------------------------" << endl; cout << "| Argumentas | Funkcijos reiksme |" << endl; cout << "----------------------------------" << endl; cout << right; // lygiuoti pagal de�inę pusę cout << fixed; // spausdinti fiksuotu formatu cout.precision(5); // spausdinti 5 skaičius po kablelio c = cp; while (c <= cg) { // Tikrinami funkcijos rė�iai ir trūkiai if (a * b - c != 0) { if (ReismeY(a, b, c, ReiksmeX(a, b, c)) < iq && ReismeY(a, b, c, ReiksmeX(a, b, c)) > iw) // Funkcijos reik�mė egzistuoja cout << "| " << c << setw(7); cout << "|" << setw(6) << ReiksmeY(a, b, c, ReiksmeX(a, b, c)); cout << setw(10) << "|" << endl; c = c + ch; } else { // Funkcijos reik�mė neegzistuoja cout << "| " << setw(5) << c; cout << " | NE |" << endl; } } cout << "----------------------------------" << endl; } } // Vienos funkcijos reik�mės skaičiavimas: // x - argumento reik�mė; double ReiksmeY (double a, double b, double c, double x) { return 2 * (b + a) + pow(x, 2) / sqrt(c); } double ReiksmeX (double a, double b, double c) { return 1 / (a - c * b); }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.67 / 8
36 Votes
http://codebin.yi.org/956
page generated in 0.01 seconds