#include "stdafx.h" #include<iostream> #include<string> using namespace std; int main() { unsigned int userInput; unsigned long long addition = 0; string sum = "0"; cout << "Enter an integer: "; cin >> userInput; for (int i = 1; i <= userInput; ++i) { addition += i; std::string intCast = std::to_string(i); sum = sum + "+" + intCast; } sum.replace(0, 2, "");//if you don't want to see 0+ cout << "\nSum of " << sum << "=" << addition; cin.get(); cin.get(); return 0; }