Input is either odd or even display

With me is a program that makes it possible for the user to make an entry of many integers as they feel like. These integers are either positive or negative. After every single input, the program has to display if the number entered is even or odd. I am able to do this separately but when it comes to the task of making both the addition function and the displaying of the status of the entered number, I have no knowhow.

Below is the code that am trying to use:
https://www.theengineeringprojects.com/2021/11/databases-and-crud-operations-in-c.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main()
{
float num1;
float num2;
char sign;
float result = 0;



start:

cout << "Enter an integer" << endl;

cin >> num1;


cout << "enter another number" << endl;

cin >> num2;


do
{
cout << "press = to finish" << endl;
cin >> sign ||num2;
result = num1 += num2;

}

while (sign != '=');

cout << "the result is: " << result << endl;



}
Last edited on
Topic archived. No new replies allowed.