Is it possible to have a piece of C++ code display a picture and how? I want to display something for my Uncle's employees at a conference were holding with them and I don't know how to display pictures, if there is a way.

Are you talking about just displaying a picture any way that works, or actually rendering the picture using C++? The former is vastly simpler; you can just start the process of a picture viewer and pass in the location of the picture to open it. The latter is quite a bit harder and not recommended.

@deceptikon Ok, thank you. That is all I needed to know.

Though, one extra question. How would I display a picture that is located on my, for example, desktop? Is it using the cout object by putting the root source of the file?

One way of doing this is using the function system from the header windows.h if you're using Windows.

#include <windows.h>
#include <string>
using namespace std;

int main(){
    string pathOfWindowsPhotoViewer="%SystemRoot%\\System32\\rundll32.exe \"%ProgramFiles%\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen ";
    string pathOfPicture="C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg";
    system(string("start "+pathOfWindowsPhotoViewer+pathOfPicture).c_str());
    return 0;
}

Edited 3 Years Ago by Lucaci Andrew

i need computer programming code picture for my work

Do you regularly ask other people to do your work? If so, I'm greatly relieved that you're not one of my coworkers.

This question has already been answered. Start a new discussion instead.