How to put images in c++?

Hi I am new to doing c++ programing, and I want to make a dichotomous key for science fair. http://en.wikibooks.org/wiki/Dichotomous_Key basically this would be that when you type in a leaf name, It pops up with a picture of it and a description/where its found. Can you please tell me how to put an image? I know how to do if statements all ready. Thank you so much in advance -Michael
Essentially, you ask the operating system to do it for you. You can do this by asking the operating system directly, using the API provided by your OS/windows manager (for example, using the Win32 API) or you can use a 3rd party library to do it for you, with you asking the library.

Here is a very simple way to show an image using a 3rd party library called CImg, which is a header file only.

1
2
3
4
5
6
7
8
9
10
#include "CImg.h"
#include <iostream>
using namespace cimg_library;

int main()
{
  CImg<float> image("imageName.png");
  CImgDisplay main_disp(image);
  std::cin.ignore();
}


Means and ways get more sophisticated from here.
Last edited on
Topic archived. No new replies allowed.