my first c++ program runtime is super long like 5 – 10 minutes on a fast CPU it's a very basic c++ program [closed]

This seems like it was purposefully un-optimized. I would assume that the time constraints are coming from modding a variable 100,000,000,000 times. But wait, that is not all. Not only do you mod a variable that many times, but when a variable modded to 0, you iterate another 11 times over each char in “Hello … Read more

C++ Looping / Array

int main(){ int n; cout<<“Enter a number: “; cin>>n; cout<<n<<” is defrayed as”<<endl; for(int i=1;i<=n/2;i++){ cout<<i<<“+”<<n-i<<” “; } cout<<endl; }

Palindrome homework exercises c++ [closed]

I am not going to give you the answer, but I will give some hints. The palindrome program is taking a string and comparing characters. More specifically, it is taking the first character, comparing it to the second-to-last, and seeing if they match. If they do, compare the second character to the third-to-last, and continue … Read more