AIIIQ4 - system"pause" system"notepad...

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("pause"); system("notepad updown.out"); 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>=0) value--; if(direction==1) if(value<=max) value++; } int updown::getvalue(void ){ return value; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online