Need to write a program in Visual Studio CLR CONSOL APPLICATION for date of birt
ID: 3674956 • Letter: N
Question
Need to write a program in Visual Studio CLR CONSOL APPLICATION for date of birth , addition , substraction .
After perfoming additon, there should be an statement " do you wish to continue ? Press Yes to continue or E to exit. Once YES is pressed , then substraction followed by date of birth. If exit is presses then the screen should get closed.
i have written a program , so please update that
#include "stdafx.h"
# include <iostream>
#include<conio.h>
#include<math.h>
using namespace std;
float addition(); //function declaration for Addition operation
float subtraction(); //function declaration for Subtraction operation
case '+':
cout << " enter num1 and num2 " << endl;
//Input Values for Addition Function
cin >> num1 >> num2;
//perform and display the added values
cout << " addition of " << num1 << " and " << num2 << " is " << num1 + num2 << endl;
break;
case '-':
cout << " enter num1 and num2 " << endl;
//Input Values for Substraction Function
cin >> num1 >> num2;
//perform and display the difference values
cout << " subtraction of " << num1 << " and " << num2 << " is " << num1 - num2 << endl;
break;
NEED A DATE OF BIRTH
getch();
return 0;
}
Explanation / Answer
#include "stdafx.h"
# include <iostream>
#include<conio.h>
#include<math.h>
using namespace std;
float addition(); //function declaration for Addition operation
float subtraction(); //function declaration for Subtraction operation
int main(){
//for subtraction/addition
int num1, num2;
// for date of birth
int dd,mm,yy;
char c;
cout << " enter num1 and num2 " << endl;
//Input Values for Addition Function
cin >> num1 >> num2;
//perform and display the added values
cout << " addition of " << num1 << " and " << num2 << " is " << num1 + num2 << endl;
cout<<"do you wish to continue ? Press Y to continue or E to exit."
cin>>c;
// if Y then go for subtraction followed by date of birth
if(c == 'Y'){
cout << " enter num1 and num2 " << endl;
//Input Values for Substraction Function
cin >> num1 >> num2;
//perform and display the difference values
cout << " subtraction of " << num1 << " and " << num2 << " is " << num1 - num2 << endl;
// date of birth
cout << " enter date, month and year: " << endl;
//Input Values for Substraction Function
cin >> dd >> mm >> yy;
//perform and display the difference values
cout << "Date of birth: " << dd << "/" << mm << "/" <<yy<< endl;
}
getch();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.