Hi !
I am trying to do a game for children to test their attention. So I have two images and they have to find out the differences between the images. How can I open the image on c++?
I also have a specie of questionair to see how many differents the kids found out. Can I open the image in the same window the questionair will be?
Thanks
This is what I have until now
#include <ctime>
#include <cstdlib>
#include <string>
#include <iostream> /* to open the image */
#include <fstream>
#include <iostream> /* to count the time taken to find out what the differences are*/
#include <stdio.h>
#include <time.h>
using namespace std;
/*int main (){
int number;
int time;
}*/
/*cout << "There are six differences between these two pictures. What are them?";*/
int main()
{
int number; /*declaration of the variable number*/
int duration; /*declaration of the variable time*/
int answer; /* declaration of the variable answer*/
std::cout << "There are six differences between these two pictures. What are them?";
ifstream image;
image.open("C:\\Documents and Settings\\B\\Desktop\\differences.jpeg");
clock_t startTime = clock();
std::cout <<"How many correct differences?";
cout <<" A) Zero" << endl;
cout << "B) One" << endl;
cout << "C) Two" << endl;
cout << "D) Three" << endl;
cout << "E) Four" << endl;
cout << "F) Five" << endl;
cout << "G) Six" << endl;
std::cin >> number;
std::cout<< "The number of differences found was " << number << std:: endl;
/*clock_t endTime = clock();
duration = endTime - startTime;
double timeInSeconds = clockTicksTaken / (double) CLOCKS_PER_SEC;*/
if (answer == 'a' || answer == 'A')
{
cout << "duration=5 minutes"
<< "number of differences=0"<<endl;
}
if (answer == 'b' || answer == 'B')
{
cout << "duration=5 minutes"
<<"number of differences=1"<<endl;
}
if (answer == 'c' || answer == 'C')
{
cout << "duration=5 minutes"
<<"number of differences=2"<<endl;
}
if (answer == 'd' || answer == 'D')
{
cout << "duration=5 minutes"
<<"number of differences=3"<<endl;
}
if (answer == 'e' || answer == 'E')
{
cout << "duration=5 minutes"
<< "number of differences=4"<<endl;
}
if (answer == 'f' || answer == 'F')
{
cout << "duration=5 minutes"
<< "number of differences=5"<<endl;
}
if (answer == 'g' || answer == 'G')
{
cout << "duration=5 minutes"
<<"number of differences=6"<<endl;
}
else
{
clock_t endTime = clock();
duration = endTime - startTime;
/*double timeInSeconds = clockTicksTaken / (double) CLOCKS_PER_SEC;*/
return 0;
}
cout << endl;
};