Simple Calculator ( NEED HELP )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>                  // Inlcudes standard input and output commands.
#include <string>                    // Needed to add a string with a value.
#include <stdlib.h>                  // Needed to use the command system("pause");
using namespace std;

int main ()
{
int O;                                //Overstaande                
int S;                                //Schuine
int A;                                //Aanliggende


cout << " Bereken de hoeken van een driehoek. De lengtes moeten worden gegeven in centimeters! " << endl; endl; endl;
cout << " Welke gegevens heb je? " << endl; endl;
cout << " Overstaande lijn in centimeters: " <<
cin >> O >> endl;
cout << " De overstaande lijn is " << O << // This is where I want it to say "the line is "Cin 0" centimeters long.
//I also want to be able to give an integer an unknown value, the value that yet has to be calculate


system("pause");                      // Stops .cmd from closing right away.
}


I also want to be able to give an integer an unknown value, the value that yet has to be calculated. For instance, I want to calculate "int A;" but the program must ask all three integers to be put in. First it should ask if there's a value for A, if there isn't then it should skip that and ask for the value of B which there will be and the same goes for C. There will always be one integer which has no value, but it has to be calculated with the SOS CAS TOA.


EDIT: NEW CODE :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>                  // Inlcudes standard input and output commands.
#include <string>                    // Needed to add a string with a value.
#include <stdlib.h>                  // Needed to use the command system("pause");
using namespace std;

int main ()
{
int O;                                //Overstaande                  
int S;                                //Schuine
int A;                                //Aanliggende


cout << " Bereken de hoeken van een driehoek. De lengtes moeten worden gegeven in centimeters! " << endl;
cout << " Heb je de overstaande lijn? Vul 0 in voor ""Nee"" " << endl;
cin >> O;

if (O == 0) 
{
       cout << "Je hebt de gegevens voor de overstaande lijn niet, vul de schuine lijn in. " << endl;
       
       cin >> S;
}
       

     
cout << " Overstaande lijn in centimeters: " <<
     
system("pause");                      // Pauses .cmd from closing right away.
}


I want the "If" loop to be like If (O == No)
Last edited on
closed account (Dy7SLyTq)
so first, to conform to c++, all of the basic c-.h headers can be represented as cNameOfHeader, so you can make stdlib.h cstdlib. second what language is this? If i HAD to stereotype i would say it looks russian. third endl makes a newline and is not a variable. so you can't cin>> to it. im guessing you want it to print a newline after the variable. just use cout. fourth for the unknown value just do zero
The language is Dutch, haha.
Thanks for replying anyways, I used this for the unknown value:

1
2
3
cout << "Fill in the length of the line A. If you haven't got the length of line A, please fill in 0." << endl;
If( A == 0)
{
Topic archived. No new replies allowed.