• anonymous
how would i write this into at least one function using what i have already
Computer Science
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • schrodinger
I got my questions answered at in under 10 minutes. Go to now for free help!
  • anonymous
#include using namespace std; int main() { int original, temp1, temp2, sum, remainder; int first, second, third, fourth; cout<<"enter an 8 digit number"<>original; temp1=original/100; first=original%100; temp2=temp1/100; second=temp1%100; fourth=temp2/100; third=temp2%100; sum=first+second+third+fourth; remainder=sum%26; cout<<"the first number is "<
  • eSpeX
Functions are great for repetitive tasks, take any one of the steps you are repeating and turn it into a function. For example, int get_six(int x){ return x/100; } temp1= get_six(original); temp2=get_six(temp1);
  • rsmith6559
Another metric for creating functions, is after you comment your code, if you read down through it, you see "paragraphs" or "stanzas" of code, they'd be candidates for a function.

Looking for something else?

Not the answer you are looking for? Search for more explanations.