AIIIQ4 - system("pause");...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <fstream> using namespace std; class updown { private: int max; int direction; int value; public: updown(int top); void count(void); int getvalue(void ); }; int main() { ofstream fout ("updown.out"); updown c(7); int i; for (i=1; i <= 18; i++) { cout << "\nc = " << c.getvalue(); fout << "\nc = " << c.getvalue(); c.count(); } fout.close();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: system(&quot;pause&quot;); system(&quot;notepad updown.out&quot;); return 0; } updown::updown(int top){ max=top; direction=1; value=0; } void updown::count(void){ if(value==max) direction=0; else if(value==0) direction=1; if(direction==0) if(value&gt;=0) value--; if(direction==1) if(value&lt;=max) value++; } int updown::getvalue(void ){ return value; }...
View Full Document

Ask a homework question - tutors are online