Hello, so I was assigned to write a program that allows a person to input two numbers and find the sum of the two.
My teacher gave us the beginning of the code to start, which is
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iomanip>
usingnamespace std;
int main() {
unsigned seed = time(0);
unsignedlong FirstRandom, SecondRandom, total;
srand(seed);
FirstRandom = (rand() % 901) + 100;
SecondRandom = (rand() % 901) + 100;
total = FirstRandom + SecondRandom;
//Welcome Message
cout<<"Hello and welcome to the tutoring center.\n\nIn order to get started with your first addition problem please enter the first number: "<<endl;
cin>>FirstRandom;
cout<<"\nNow please enter the second number: "<<endl;
cin>>SecondRandom;
//Waits for student to press Enter in order to proceed
cout<<"\nNow once you are done solving the problem yourself, please press the enter button to receive the answer."<<endl;
cin.get();
//The Answer
cout<<"The sum of "<< setw(5) << FirstRandom << "and";
cout<< setw(5) << SecondRandom << "is " << setw(5) << total <<endl;
return 0;
]
but on xCode it gives me this error (implicit conversion loses integer precision: "time_t" (aka 'long') to 'unsigned int') on the statement