Changed printf statements to cout