Write C programs to perform the following tasks In many of t

Write C++ programs to perform the following tasks. In many of the program descriptions below, example input and output is provided. NOTE: You don’t need arrays to solve any of these problems. You should NOT use arrays to solve any of these problems. You should also not use string manipulation beyond extraction from an std::stringstream, if needed.

exclusive.cpp: Let the user input an odd number of positive integers, space separated, on a single line (as seen below). Assume that each integer except for one, the exclusive integer, appears an even number of times in the input. Your program should output the exclusive integer. Remember, you do not need nor should you use an array to solve this problem. You should also not use string manipulation beyond extraction from an std::stringstream, if needed.

endtime.cpp: Write a program to read two integers with the following significance. The first integer value represents a time of day on a 24 hour clock, so that 1245 represents quarter to one mid-day, for example. The second integer represents a time duration in a similar way, so that 345 represents three hours and 45 minutes. This duration is to be added to the first time, and the result printed out in the same notation, in this case 1630 which is the time 3 hours and 45 minutes after 12.45.

Solution

// C++ code exclusive.cpp
#include <iostream>
#include <string>
#include <sstream>
using namespace std;


int main()
{
string number;
int result = 0;
  

cout << \"Enter integers: \";
while(cin >> number)
{
if(number == \"\ \")
break;
result = stoi(number)^result;

cout << \"Exclusive: \" << result << endl;   
}

cout << \"Exclusive: \" << result << endl;

return 0;
}


/*
output:

Enter integers: 2 1 55 3 2 1 4 4 2 2 55
Exclusive: 3

*/


// C++ code endtime.cpp
#include <iostream>
#include <string>
#include <sstream>
#include <stdio.h>
using namespace std;


int main()
{
int duration,durationHours,duration_Minutess,time,inputHours,minutes;
cout << \"Enter in a start time: \";
cin >> time;
int input2;
cout << \"Enter a duration: \";
cin >> duration;

inputHours = time / 100;
minutes = time - (inputHours * 100);

durationHours = duration / 100;
duration_Minutess = duration - (durationHours * 100);
minutes += duration_Minutess;

while(minutes > 60)
{
inputHours++;
minutes -= 60;
}

time = (inputHours * 100) + minutes;

if(time >= 2400)
{
time -= 2400;
}
cout << \"End time is: \" << time << endl;
return 0;
}


/*
output:

Enter in a start time: 1415
Enter a duration: 50
End time is: 1505

*/

Write C++ programs to perform the following tasks. In many of the program descriptions below, example input and output is provided. NOTE: You don’t need arrays
Write C++ programs to perform the following tasks. In many of the program descriptions below, example input and output is provided. NOTE: You don’t need arrays

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site