0
How to add the result ? ( Description )
hai there, i have given chance to user to type in there value ( to find lucky number i first asked them to type date,and after they type date i asked them to type month number,and then for year) at last i added a code to do sum of date,month,year and let's consider the result is something like 2345 ( sum of date,month,year) and now i want a code to do sum of that 2345 up to only one digit out put ( lucky number) thank u soo much
4 ответов
+ 1
I am not sure if I understood you.
It might be like this:
#include <iostream> /*input output lib*/
using namespace std; /*to avoid std::*/
int main() {
int year,month,day;
cout<<"Type a year(number): ";
cin>> year;
cout<<"Type a month(number): ";
cin>> month;
cout<<"Type a day(number): ";
cin>> day;
cout<<"Lucky number for this day is: "<< year+month+day " .";
return 0;
}
0
hai @roman yes, exactly
now,please assume that you have typed all the values
mine ( 25 + 03 + 1998 ) date + month + year= lucky number
so after all that code and sum, i m getting 2026 ( when i add 25+03+1998 )...now what i need is the code to add 2+0+2+6 ( 2026 )
thank you soo much
0
You can use vector<int>myVector() and store each int on index.
I finished C and now I am newbie in new C++ features so google it and you might find the answers :)
Goodluck
0
thank you soo much 😍