| | |
Ask about program
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 101
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { //delcare varialbe char selection; //declare function void counting_loop(); void impossible(); void missing_item(); void odd_even(); void poem(); void pause_m(void); do { cout << " Welcome to the Fun Program" << endl; cout << " Select from the menu " << endl ; cout << "A gets Counting loop. " << endl; cout << "B gets Impossible."<< endl; cout << "C gets Missing Item."<< endl; cout << "D gets Odd or Even." << endl ; cout << "E gets Poem." << endl; cout << " Enter the letter of your choice. " << endl; cout << " Then hit the enter key. " << endl; cout << " Your choice : --> " ; cin >> selection ; // switch command switch (selection) { case 'a': case 'A': counting_loop(); // call function break; case 'b': case 'B': impossible();// call function break; case 'c': case 'C': missing_item(); break; case 'd': case 'D' : odd_even(); break; case 'e': case 'E': poem(); }// end switch } while (selection!='Q'&&selection!='q'); } // function definition //couting_loop void counting_loop() { for (int x=0 ; x< 5; x++) { cout << "Are we having fun ?" << endl ; pause_m(); } }// end for // call function pause //---------------------------------------------// //fucntion pause void pause_m(void) { cout << "\n\n"; system("PAUSE"); cout << "\n\n"; return; } //------------------------------------------// //clear function void clear_m(void) { system("CLS"); return; } //---------------------------------------// void impossible() { cout << " The repeat until loop is impossible in C++." << endl; pause_m(); } void missing_item() { cout << "This program is missing only the while loop." << endl ; pause_m(); } void odd_even() { int userinput; cout << " Enter an integer : " << endl; cin >> userinput; if ( userinput % 2 = 0) { cout << " Your number was odd. " << endl ; } else { cout << " Your number was even. " << endl ; } pause_m(); } void poem() { cout <<"Feelings that once were hidden" <<endl; cout <<"Are now expressed to you." << endl; cout <<"Days that once were stormy" << endl; cout <<"Are now the brightest blue." << endl; pause_m(); }
it kept saying that the fucntion pause is undeclare ? dont' know why ? anyhelps are appirciated
•
•
Join Date: Jan 2008
Posts: 3,842
Reputation:
Solved Threads: 503
0
#2 Nov 3rd, 2009
If you use "system", you should import cstdlib, because that's the library "system" is from.
But don't use system ("PAUSE") anyway. Use cin.get() once or twice instead.
http://www.gidnetwork.com/b-61.html
But don't use system ("PAUSE") anyway. Use cin.get() once or twice instead.
http://www.gidnetwork.com/b-61.html
•
•
Join Date: Jan 2008
Posts: 3,842
Reputation:
Solved Threads: 503
0
#4 Nov 3rd, 2009
•
•
•
•
i don't know what you means., .... i incpluded the using namespace std;
other program runs well
i have to use that beacuase that's the requirement
http://www.cplusplus.com/reference/c...stdlib/system/
"system" is in cstdlib, not iostream.
But you're right. That's not the problem. You need to proofread your posts. The error isn't that "PAUSE" can't be found, it's that "pause_m" can't be found, so I saw "system" and saw that you hadn't included the cstdlib library, so I figured that could be the problem.
Look at lines 9 - 15. You should move them to before line 4.
![]() |
Similar Threads
- AutoExecuting a program Without Explorer (Windows NT / 2000 / XP)
- Program help required (Assembly)
- Help with a program (Java)
- Add compression to my program (C++)
- Cool little Program to disable startup programs (Windows NT / 2000 / XP)
- 3d Program (Game Development)
Other Threads in the C++ Forum
Views: 153 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






