View Single Post
Old May 4th, 2008, 4:52 PM   #12
Arnack
Programmer
 
Join Date: Jul 2005
Posts: 66
Rep Power: 4 Arnack is on a distinguished road
Re: Simple if statement question :(

C++ Syntax (Toggle Plain Text)
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <iostream>
  5. #include <cctype>
  6. #include <windows.h>
  7. //"Mage Wars" copyright Crimson Games 2007. All rights reserved.
  8. //Created by Arnack, distributing this source is permited, as long
  9. //as ownership is shown.
  10.  
  11. using namespace std;
  12. int always = 1;
  13. int gold = 10;
  14. int level = 1;
  15. int health = 10;
  16. string city;
  17. int check = 1;
  18. string area;
  19.  
  20. void stats()
  21. {
  22. cout << "|------------------------------|\n";
  23. cout << "| ~STATS BAR~ |\n";
  24. cout << "|------------------------------|\n";
  25. cout << " You are level " << level << "! \n";
  26. cout << " You have " << gold << " gold!\n";
  27. cout << " Current Area: " << area<< " \n";
  28. cout << " Current City: " << city <<"\n";
  29. cout << "|------------------------------|\n\n";
  30. }
  31.  
  32.  
  33.  
  34.  
  35. void start()
  36. {
  37.  
  38. city = "Paradon";
  39.  
  40. cout << "\nHello, and welcome to the world of Coloren. ";
  41. cout << "This land is ruled by evil, twisted creatures coined \"Lethars\". \n";
  42. cout << "They have corrupted the world with their evil. The land screams of an hero, and I have selected you. \n";
  43. cout << "Good luck, stranger.\n\n";
  44. system("PAUSE");
  45. check = 2;
  46. }
  47. void maingame()
  48. {
  49. system("CLS");
  50. void stats();
  51. city = "Paradon";
  52. area = "Outside StoneKeg Inn";
  53.  
  54. cout << "Elder Herald: \"There are many things to do before you will become recognized.";
  55. cout << "You may buy and sell items at the town shoppe. Also, you can go out in the wilderness and fight enemies.";
  56. cout << "Come see me when you are level 5 or higher.\"" << endl;
  57. system("PAUSE");
  58.  
  59. }
  60.  
  61.  
  62. int main()
  63. {
  64. while (always == 1)
  65. {
  66. system("CLS");
  67. stats();
  68. if (check == 1)
  69. {
  70. start();
  71. }
  72. else
  73. {
  74. maingame();
  75.  
  76. }
  77.  
  78. }}
My problem is that after I get past the first void and go onto the second void, the stats void does not even come up.
__________________
Ack Network
*UNDER CONSTRUCTION*
Now hiring staff of all sorts.
Arnack is offline   Reply With Quote