Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ Utilizzando Visual C++ Express Edition 2008 ]
- ### stdafx.h
- // stdafx.h : include file for standard system include files,
- // or project specific include files that are used frequently, but
- // are changed infrequently
- #pragma once
- // TODO: reference additional headers your program requires here
- #include <stdio.h>
- #include <iostream>
- #include <math.h>
- ### CalcoloDelta.cpp
- // CalcoloDelta.cpp : main project file.
- #include "stdafx.h"
- using namespace std;
- using namespace System;
- int main() {
- INIZIO:
- float a; float b; float c;
- cout << "CALCOLO DEL DELTA\n" << endl;
- // V b^2 - 4ac
- cout << "Inserisci A: ";
- cin >> a;
- cout << "Inserisci B: ";
- cin >> b;
- cout << "Inserisci C: ";
- cin >> c;
- float ris;
- cout << "\n\nValori inseriti: " << endl;
- cout << "A: " << a << "\nB: " << b << "\nC: " << c << endl;
- b = pow(b,2);
- cout << "\nB^2: " << b << endl;
- ris = (b - (4 * a * c));
- cout << "\nb^2 - (4 * a * c) = " << "\n= " << b << " - (4 * " << a << " * " << c << ") = " << "\n= " << ris << endl;
- if(ris < 0) { cout << "\nDelta negativo" <<endl; }
- if(ris > 0) { cout << "\nDelta positivo" << endl; }
- if(ris == 0) { cout << "\nDelta uguale a zero" << endl; }
- CHIUDI:
- cout << "\nInserisci Y per ricominciare, oppure N per chiudere. Poi premi Invio." << endl;
- String^ t;
- t = Console::ReadLine();
- if(t == "N" || t == "n") {
- exit;
- }
- else if(t == "Y" || t == "y") {
- cout << "\n\nRicominciamo...\n\n";
- goto INIZIO;
- }
- else {
- cout << "\nValore non riconosciuto" << endl;
- goto CHIUDI;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement