triumphost 120 Posting Whiz

as far as I see, he needs == instead of = as he is declaring them as int and double..
Making them equal a number rather than comparing them to true or false.

As for the char* cant be converted to char[30] thats an error on his part at

char* Essential::GetProductDescription() const
{
return (ProductDescription);
triumphost 120 Posting Whiz

:S is this not the c++ forum?

triumphost 120 Posting Whiz

psh lol thats not complicated at all.. also what kinda of code they want it in??

MFC? API?? Windows Form???

triumphost 120 Posting Whiz

wow... in 12 lines?? :O :S I'd like to see that..
And too complexed?? How? Sorry for posting the whole code. I just thought he showed effort. Maybe not enough I guess. Ill think next time before posting code..

triumphost 120 Posting Whiz

More Simplified.. And Im sorry for the second post.. But this Idea just came to my head..

#include <iostream>
#include <windows.h>
#include <cmath>
#include <math.h>

using namespace std;

int feet1, feet2, inches1, inches2, inchestotal;
double modinches1, modinches2, feettotal;

int main()
{
    cout<<"Enter the amount of feet: ";
    cin>> feet1;
    cin.ignore();
    cout<<"Enter the amount of inches: ";
    cin>> inches1;
    cin.ignore();
    cout<<"Enter the second amount of feet: ";
    cin>> feet2;
    cin.ignore();
    cout<<"Enter the second amount of inches: ";
    cin>> inches2;
    cin.ignore();
    
    modinches1 = inches1%12;
    modinches2 = inches2%12;
    double modinchestotal = ((inches1 + inches2)%12);
    
    if ((modinches1 < 1) && (modinches2 < 1)) //If both inches are divisible by 12 (a whole number) then...
    {
      feettotal = (feet1 + feet2);
      inchestotal = ((inches1 + inches2)/12);
      double feetgrandtotal = (feettotal + inchestotal);
      cout<<feetgrandtotal<<" feet "<< modinchestotal<<" inches\n";
    }
    else //Just Else.. or U can use ((modinches1 < 1) && (modinches2 < 1))||((modinches1 < 1) && (modinches2 < 1))||((modinches1 > 1) && (modinches2 <= 1))  Etc.. etc.. etc... Notice the || operator between them.. meh just stick to Else..
    {
         inchestotal = (inches1 + inches2);
         int inchesdivis = ((inchestotal)/12);
         feettotal = ((feet1 + feet2) + inchesdivis);
         int modinchesgrandtotal = ((inches1 + inches2)%12);
         
         cout<<feettotal<<" feet "<<modinchesgrandtotal<<" inches\n";
    }
    
    system("Pause");
    return 0;    
}
triumphost 120 Posting Whiz

Uhhh I will help u.. I have noticed u got the math wrong.. U havent thought of what happens if the person enters 12, 24, 36 inches (multiples of 12).. then to convert that to feet.. What if the person enters 15 (its greater than 12 but not a multiple)..

U see where Im going with this? Also you are declaring variables that arent being used.. and u are calling for them.. In your calculations, fft, iin was not used.. neither were ft3 and in3.. so there for when u call for total, itll always equal 0.
This is because no operations were performed on it.. nor does it hold any values.

anyway I just took the time out of my life (1.5hrs) to write the code hoping you will understand it and to teach others.. I have to say it was quite difficult to understand what to do when they enter a number larger than 12 but not a multiple of 12.. and what to do if they enter a number that is 12 or a multiple of it.. also what to do if the number is less than 12...

here is the code for future people.. I found it quite INTERESTING!! Because I couldnt find a way to determine if the numbers were whole or not when divided without going through a whole bunch of crap.

#include <iostream>
#include <windows.h>
#include <cmath>
#include <math.h>

using namespace std;

int feet1, feet2, inches1, inches2, inchestotal; …
triumphost 120 Posting Whiz

:S Linux compiler?? Mingw?? I dont got the wait.h header nor the unistd header. Or else I'd compile it..

For anyone trying to help him, this is a linux system he is compiling on..

triumphost 120 Posting Whiz
#include <iostream>
#include <windows.h>
#include <math.h>
#include <cmath>
#include <string>
#include <sstream>

using namespace std;

	int num;
	int ones_digit;
	int tens_digit;

int main()
{	
    cout<<"Enter 1 or 2 digits\n\n";
    cin>> num;
    cin.ignore();
    
    string num2;
    stringstream out;
    out << num;
    num2 = out.str();
    num2.length();
    
    ones_digit = num%10;
    tens_digit = num/10;
    
    
    if ((num >= 0) && (num <=19))
    {
       switch(num)
             {
                               case 0: cout<<"Zero";
                               break;
                               
                               case 1: cout<<"One";
                               break;
                               
                               case 2: cout<<"Two";
                               break;
                               
                               case 3: cout<<"Three";
                               break;
                               
                               case 4: cout<<"Four";
                               break;
                               
                               case 5: cout<<"Five";
                               break;
                               
                               case 6: cout<<"Six";
                               break;
                               
                               case 7: cout<<"Seven";
                               break;
                               
                               case 8: cout<<"Eight";
                               break;
                               
                               case 9: cout<<"Nine";
                               break;
                               
                    case 10: cout<<"Ten";
                    break;
                    
                    case 11: cout<<"Eleven";
                    break;
                    
                    case 12: cout<<"Twelve";
                    break;
                    
                    case 13: cout<<"Thirteen";
                    break;
                    
                    case 14: cout<<"Fourteen";
                    break;
                    
                    case 15: cout<<"Fifteen";
                    break;
                    
                    case 16: cout<<"Sixteen";
                    break;
                    
                    case 17: cout<<"Seventeen";
                    break;
                    
                    case 18: cout<<"Eighteen";
                    break;
                    
                    case 19: cout<<"Nineteen";
                    break;
                    
                    default: cout<<"Error";
                    break;
             }
    }
    else if((num2.length() == 2) && ((num >= 20) && (num <=99)))
    {
    switch(tens_digit)
    {
                       case 2: cout<<"Twenty";
                       break;
                       
                       case 3: cout<<"Thirty";
                       break;
                       
                       case 4: cout<<"Forty";
                       break;
                       
                       case 5: cout<<"Fifty";
                       break;
                       
                       case 6: cout<<"Sixty";
                       break;
    }
            switch (ones_digit)
		{
			case 0:
				cout << " ";
				break;
			case 1: 
                 cout << "-one";
				break;
			case 2:
				cout << "-two";
				break;
			case 3:
				cout << "-three";
				break;
			case 4:
				cout << "-four";
				break;
			case 5:
				cout << "-five";
				break;
			case 6:
				cout << "-six";
				break;
			case 7:
				cout << "-seven";
				break;
			case 8:
				cout << "-eight";
				break;
			case 9:
				cout << "-nine";
				break;
			default:
				cout << "Error";
       }
    } …
triumphost 120 Posting Whiz

:( Doesnt work for me.. I compiled my program like 47 times already in 32 bit. When transfered to any of my friends' computers, it doesnt run.. It crashes still and gives that error.. *sigh*

triumphost 120 Posting Whiz

yes I meant function prototype..

That is how you use it :S
I've used that code and it compiled perfectly. No ancient.. I meant c++
See the managed attachments for examples of the code in action..
Written by myself of course but yeah I meant function prototypes.. for some reason I always call it prototype function :S

triumphost 120 Posting Whiz

Note: I program in C++ Not C#.

In visual studio 2010, Where u press release or debug, next to it has a box with win32..
How can I change it to x86.. I tried pressing New and edit and stuff and configuration manager but it doesnt have the x86 choice... only Ithanium, x64, x32.. But if I choose Ithanium, it will not run on any computers that dont have an Ithanium Processor.. If I chose x64, it doesnt run an any computer that doesnt have a 64bit OS.. If I press x32, It doesnt run on a x64 computer :S

It seems as though my program only crashes on non-development machines..

I read that the solution to solve it is the following in which I cannot find x86:

First, select Tools...Options...Projects and Solutions and make sure the Show advanced build configurations option is checked.

Then select Build...Configuration Manager and click the Platform dropdown. If the x86 option is not in the dropdown list then select
<New...> and x86 from the New Project Platform dialog. Select x86 as the Platform option. After compiling your application it will in 64-bit WoW (32-bit Windows) under 64-bit Windows.

Others with the same problem (might be described better than I can):

http://social.microsoft.com/Forums/en-US/Offtopic/thread/642a63cb-a05b-41f3-8070-31f4f6a2113c
and
http://social.msdn.microsoft.com/Forums/en/Vsexpressvb/thread/7fc988c6-6821-469b-8138-1767ebaffaa4

Anyone know how I can get this x86 option??? I really need it bad!

Things Tried: Re-installing (not by uninstalling first and then reinstalling but rather I double …

triumphost 120 Posting Whiz

You can use cases..

#include <iostream>
#include <string>
using namespace std;

char nSel;
void getinput();

int main()
{
   cout
    << "\tAurDown v2.1\n"

    << "\tLicense: GPL3\n\n"
    << "Menu\n"
    << "1. Search for package\n"
    << "2. Download a package\n";
   cout << "Enter Selection\t";
   getinput();
return 0;
}


void getinput()
{
     cin>>nSel;
     cin.ignore();
     switch(nSel)
     {
              case '1': cout<<"You chose to Search for a package\n";  //U can put anything here...
                        break;
              case '2': cout<<"You chose to download a package\n";
              break;
              default: cout<<"Please Enter a valid selection\n";
                       getinput();
              break;
     }     
}

That should definitely work.. If the user presses

1.. it prints they selected to search.
2.. It prints the selected to download..

Anything else, It prints "Please Enter a valid selection" and lets them choose again.. if they enter anything else again, it just repeats until they enter a valid selection such as 1 or 2.

The function "getinput();" is a prototype function.. But prototype functions work wonders.. especially in situations like these!

triumphost 120 Posting Whiz

Edited: Forgot to log in before writing out this post.. so now it looks messed up as hell so I dont wanna rewrite it but I hope it helps!


mhmm Open visual studio, press ctrl shift N or else just press file -> New -> Project
Create a "WINDOWS FORM APPLICATION"

A windows will show up.. U will now see "Form1.h [Design]"

If u double click on it, you can see the code for the form..
If u want to add a button, point the mouse at the toolbar on the left side (vs2008) right side (vs2010) {default positions}

When the toolbar expands, drag and drop a button to the form1.h design.. and place it in the window..

Now u have a button, double click the button to make form the code.. and now u can add code to the button..

Add a textbox the same way and double click it.. the code is now formed and u can make it so that when the person presses the button, output everything into the textbox.. or u can use a messagebox to show commands..

#pragma endregion is usually where the codes are added.. such as buttons, textboxes, comboboxes.. etc..

Example:

#pragma endregion

      private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) 
      }
      private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
      int c3; //declare c3 as an integer.
      Int32::TryParse(textBox3->Text,c3); //take textbox3 text and check if its an integer/
      int c5; //declare c5 as an …
triumphost 120 Posting Whiz

wwwwwwo.. U have a long name but do not assume..

It is not a crack actually.. it is just an example of what I would like to do.. It can easily be an exe or binary file rather than a dll file
Its for a program called blackra1n for the iphone.. I noticed that the developers were missing a dll file.. and every single time I have to download the dll file, place it in the same folder and then run the program for my iphone.
I was just curious as to how they got the program to include such a file or any files in it without making an installer.. If you see my previous posts you will see that I've made installers for my programs rather than doing it this way.. But I dont want to make an installer because if a user deletes the file then my program will not be able to work.. correct??

I was following this tutorial: http://syedgakbar.wordpress.com/2007/11/07/embedding-dll-and-binary-files-in-the-executable-applications/

Im not sure if I was allowed to link that above.. but I've been following it and everytime I try to get the file to extract from my .exe and be used by the lines:

String^ originalFile = "My.dll";
String^ fileToReplace = "C:\\Program Files\\Software\\My2.dll";
String^ backUpOfFileToReplace = "C:\\Program Files\\Software\\My.dll.bac";

It fails to find the file and it even fails to extract the file like the link says..

triumphost 120 Posting Whiz
int isRunning(char *pProcessName)
{
    HANDLE hSnap = INVALID_HANDLE_VALUE;
    HANDLE hProcess = INVALID_HANDLE_VALUE;
    PROCESSENTRY32 ProcessStruct;
    ProcessStruct.dwSize = sizeof(PROCESSENTRY32);
    hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    if(hSnap == INVALID_HANDLE_VALUE)
        return -1;
    if(Process32First(hSnap, &ProcessStruct) == FALSE)
        return -1;
    do
    {
        if(stricmp(strupr(ProcessStruct.szExeFile), pProcessName)==0)
        {
            CloseHandle( hSnap );
            return  ProcessStruct.th32ProcessID;
            break;
        }
    }
    while( Process32Next( hSnap, &ProcessStruct ) );
    CloseHandle( hSnap );
    return -1;
}

Taken from another site.. not sure if im allowed to link the source.. but thats how I went about it when I had to do it.. just modified it a bit.. cuz the original was segfaulting.. :(

triumphost 120 Posting Whiz

Hi Everyone, Im using visual studio 2010 windows form application.

I created a windows form application to add and remove files to a directory on the click of the button1.

The problem is that when I put it on a different computer, it can never find those files.. Its supposed to be a distributable program.. So it should always find the files and remove it. The file it is supposed to find and remove is a .dll file and then it replaces it with a new .dll file.

I read up on resource files as I saw somewhere that this is the only way to do it without making an installer.

Thing is Im not sure how to go about adding my .dll file to the program and then making the program copy the .dll file to the new directory.

This is what I have so far:

#pragma once

namespace ProgWithGUI {

	using namespace System;
	using namespace System::IO;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Label^  label1;
	protected: 
	private: System::Windows::Forms::Button^  button1;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows …
triumphost 120 Posting Whiz

I don't know if it would suit your project, but what if you had two arrow buttons in between your text boxes:

________________          _______________
|     1        |          |       2      |
|______________|  ->  <-  |______________|

The first arrow would convert from box 1 and place the calculated value in box 2, and the second arrow would take the value in 2 and place the calculated value in box 1. Then the circular dependency between the two wouldn't be needed. You'll probably need to have a couple of boolean values to determine whether the value in the box was freshly calculated and can be used in subsequent calculations. Again, just a suggestion.

Mhmm that's a great idea.. To be honest, I had it all in the calculate button so when it's pressed, the values get calculated n outputted in the textboxes.. That worked great but I wanted to ask here first about this loop because I didn't want the need to press the button.. I just wanted it o be imported and calculated instantly.. But your arrows are a great idea, I will only need one of them though, I will make the boxes update one way and use our idea to make it update the otherway without the loops.. Tyvm. Never cease to amaze me with hour responses

triumphost 120 Posting Whiz

Yes I ran it multiple times and didnt have that problem until I added the code to

private: System::Void textBox3_TextChanged(System::Object^ sender, System::EventArgs^ e)

And

private: System::Void textBox4_TextChanged(System::Object^ sender, System::EventArgs^ e)

I've tried making just a small form with two textboxes as suggested... Same problem :S

Thing is, textbox3 was fine, then when I added it to textbox4, Neither could be edited by the user..

The code was, if user enters 1-99 in textbox3, change textbox4 value to xxxxx... if user enters yyyyyy in textbox4, change textbox3 value to 1-99... and I think that is the problem.. but I dont know how to get around it..

triumphost 120 Posting Whiz

Using Windows Form Application from Visual Studio 2010.

KK The big problem... When I compile it and run the program, Enter a value into the textbox, it automatically changes to a value the program has defaulted.

I'll attach the Program/Project Folder incase anyone wants to compile/run it..

Example: Two textboxes.. Both Linked to eachother by code, If a value in one changes, the other automatically changes.. So when the User inputs a value into the first one, the second one automatically changes that value (in the first textbox) to a default one and Vice-Versa. That way I cannot get the user input calculated...

Is there a way to stop this!? or is it some loop that I cannot get out of?!

:( First Form Program and Already this much trouble :(
Been working on it all day + 2 hours last night.

#pragma once

namespace SlayerCalculator {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  button1;
	protected: 
	private: System::Windows::Forms::ComboBox^  comboBox1;
	private: System::Windows::Forms::Label^  TaskLabel;
	private: System::Windows::Forms::ComboBox^  comboBox2;
	private: System::Windows::Forms::Label^  MasterLabel;
	private: System::Windows::Forms::TextBox^  textBox1;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::TextBox^  textBox2;
	private: System::Windows::Forms::Label^  label2; …
triumphost 120 Posting Whiz

Got it!! Thank bro your the best... just the little hints u gave.. Code incase anyone wants it:

private: System::Void comboBox2_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			 comboBox2->SelectedItem->ToString();
			 if(comboBox2->SelectedItem == "123"){
				int tb1;
				Int32::TryParse(textBox1->Text,tb1); //enclose this in an if to make your own error handling
				int tb2 = tb1+comboBox2->SelectedIndex+10; 
				//it doesn't matter what's in the box, just use the offset
				textBox2->Text = tb2.ToString();
			 }
			 else if(comboBox2->SelectedItem == "456"){
				 int tb3;
				 Int32::TryParse(textBox1->Text,tb3);
				 int tb4 = tb3+comboBox2->SelectedIndex+14;
				 textBox2->Text = tb4.ToString();
			 }
triumphost 120 Posting Whiz

NVM Got it to work.. Now it adds 12 and stuff but when I select option 2, it adds 13, option 3 it adds 14... I wanted to choose what to add to each option... do you or anyone know how to do that?

triumphost 120 Posting Whiz

I tried making a form with just a combobox.. I couldnt get it to work..

Every option I selected added +12 to the value... resulting in total of 11..

example: i entered 0, it added 12 to it.. resulted in 11.. Guess cuz the index is -1 :S
when I seletected first option, same thing, second option, same thing, third, same answer.

triumphost 120 Posting Whiz

Wow thats exactly what I wanted... saw that on a youtube video but the part I did not understand is the (tb1value+comboBox1->SelectedIndex+12;)... The selected index part is the piece of that line i dont understand..

I wanted it so that if they select the first option in the box, add 12.. if the second option add 13 if third add whatever.. does that do it for me? what does that selected index do? I know its if they select and option but does this apply to a specific option or all options in the combobox?

Would I do.. if (comboBox1.SelectedIndex == "Chaeldar (Lost City)") add 12? or 13? or 19? or whatever? (I know how to add to it)

triumphost 120 Posting Whiz

The code below is what I'm having problems with... The combobox part is getting me angry and i've searched everywhere, code guru, msdn, stackoverflow, daniweb... And I cant figure it out. Its for a game my friend plays. I play and quit on and off.. I decided to do a calculator for him..

Problem: Cannot figure out how to determine which item the person clicked in the combobox... I will post a picture of the program in the attachments and the project folder.

//Snippet that Im having trouble with... + My attempt.

private: System::Void comboBox2_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
		if (comboBox1.SelectedText == "Chaeldar (Lost City)")
        {
			 int TPOC = Convert::ToInt32((c1)+ '12');    
			 this->textBox2->Text = TPOC.ToString();
//Attempted to add 12 to the value from textbox1(inputted by the user) when this option from the combo box is selected and then put that answer in textbox2.

        }
        else if (comboBox2.SelectedText == "Duradel/Lapalok (Shilo Village)")
        {
          
// add 13 to textbox1 value if this option is selected from the combobox.
        }
}
//Full Program code. Problem at line 348..

#pragma once

namespace SlayerCalculator {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		} …
triumphost 120 Posting Whiz

Is there anyway to make it not wait for the return value?


Figured it out by changing the key to:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]

Current User instead of Local Machine... that loads the desktop then runs the programs...

Pretty stupid that I cant skip the return value or anything :(

triumphost 120 Posting Whiz

well it cant end... its an antivirus... it stays running on the system

triumphost 120 Posting Whiz

This is a program that is supposed to run on startup when the computer turns on...
What I did was I put the name of the program in the RunOnce Registry key attached below... when u double click the key, it puts the program name in the registry telling it to run the program on boot once and after that the key is deleted from the registry. The program was placed in my C:/Windows folder which is where the RunOnce key says to look... If it cant find the program, itll just skip it and load everything else.

thing is the program does get found, it does start... but it only prints/couts the first line onto the screen, opens another program aka system("\"C:/Program Files/Alwil Software/Avast5/AvastUI.exe\""); and then it never moves, it does nothing after that... it just stays on the screen showing cout<<"Opening Avast5\n"; It wont cout/print anything thing else after the system command... WHY? What have I done wrong? Why does the program not continue printing the rest of stuff/continue moving :S

If u want to see what I mean, doubleclick RunOnce.REG (dont worry it deletes itself after 1 boot). Copy patcherscript.exe to C:/Windows. and reboot... the program will then run and GET STUCK and delete the RunOnce =(

Note: if u are going to help... the RunOnce.cpp needs to be changed/rename/change extension to .REG so itll be RunOnce.REG not .cpp

U can edit it in a text file such as notepad just to …

triumphost 120 Posting Whiz

I hope so and I found bugs in your code aswell where if I type the confirm char before the price comes up, it skips confirming...

example:

if I press y = yes here... it skips asking
Do you want to pay 15$ for this locker?
cin>>x;
if (x == y)
{
  cout<<"paid";
}
else if(x == n)
{
  cout<<"choose a different locker";
}

it skips all of the code and goes back to the main menu...
another thing is lets say I choose a locker in the first *Column* and then press yes to confirm it, when I go to choose another locker aka the one right below it, it lets me choose whether or not to pay... while deciding if u want to pay, press the right arrow and u will see the previous choice from the first time...=> u will see the letter "y". now if I exit, restart, choose my first locker again(first COLUMN), paid.. and go to choose a second locker, *presses the right arrow*, *presses enter*, u will notice that the previous choice was already in memory and will be confirmed automatically when u press enter...

Fortunately for u... I just decided to spend 10 minutes and figure out how to fix this without doing all that clear memory bs... and the solution was:
when user presses right key during locker selection, automatically press backspace = erase last choice...
when user presses left key during locker selection, automatically …

triumphost 120 Posting Whiz

Due to not being able to edit previous posts after 30 mins, i posted the following below...

rent_step3: 
   gotoxy(0,16);
   string rental_price (locker_data[stack_no][y_position][x_position],2,2); 
   cout << "The rental price is $" << rental_price << endl;
   
   fflush(stdin);
   char confirm[10];
   confirm[0]='u';
   do{
      cout << "Rent Paid(y/n): "<< flush;
	  fflush(stdin);
      cin.clear();
      cin >> confirm;
   }while(strlen(confirm)>1 || !(confirm[0]=='y'||confirm[0]=='Y'||
			                     confirm[0]=='n'||confirm[0]=='N'));  

   fflush(stdin);
   if(confirm[0]=='y' || confirm[0]=='Y'){
	   confirm[0]='u';
	   cout << "*** PAID!!! ***";
	   cin.get();                                  //Notice the cin.get(); That waits for u to press enter and then it does not go back to rent a locker but rather it goes back to the floor selection menu because of your return command... aka going back to

void rent_locker();

I just noticed ur problem is when u press no and it skips asking u to choose a floor... this is because the memory is not cleared and it keeps that choice stored... stack_no still has the value stored from the previous time that u chose the locker... so u need to clear stack_no so that it allows u to choose which floor u want.. I will try n see if I can do that with all these goto's everywhere but I had that problem yesterday and solved it.... my solution was to remove goto commands as they do not deconstruct properly... rather they skip over all the code and jumps to a specified point in the program... this leaves all that stuff in the memory and doesnt clear it... at least thats what I read on the stackoverflow website last night.. i …

triumphost 120 Posting Whiz

Well first off main() cannot be void... it must return int... so I changed it to

int main()       //changed void main() to int main()
{
  .............
}

Also the code below needs redeclaration of i
cuz its declared in the first for statement and it is not in scope in the second for statement. you gotta declare another variable for the second for statement.
See i isnt declared outside the first loop and is fixed below..

for(i=0;i<4;i++;){                                              // your also missing ;  which was fixed after the j++ and before the )
	   for(int j=0;j<25;j++){
		   if(check_available(stack_no,[b]i=0[/b],j)==1){                            // Changed i to i=0
			   x_position=j;
			   y_position=i;
			   break;
		   }
	   }

OR u can do the following:

int i=0;       // Put "i" outside the scope of the for function so it is defined for all functions below
   for(i<4;i++){
	   for(int j=0;j<25;j++){
		   if(check_available(stack_no,i,j)==1){
			   x_position=j;
			   y_position=i;
			   break;
		   }
	   }

As for getasynckey.. cant u just do:

if(keybd_event(VK_RETURN, 0, 0, 0); keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);)
{
      //code
}

Not sure if the above will work...

but Im trying to fix it right now... hopefully I come up with a solution... btw in other compilers, putting the variable inside the scope like that is illegal... microsoft's compiler for some reason accepts this and says its appropriate...

triumphost 120 Posting Whiz

Well its my first time using functions so Im not really sure what u mean by add it before main because I tried putting the function before main and then it gives absolutely no input... so I undid it and fixed the names below...


int main() runs function start(); which then does RegRun(); and asks the user if they want to run it, and getinput();
if yes, continue; if no, then askagain() which asks if they would like to try again.
if they say yes again, RegRun() & saymsg(); & getinput(); which asks if they pressed yes this time and waits for input. if no, exit(0); and if they press anything else, askagain.

#include <iostream>
#include "Windows.h"

using namespace std;
char x,y,z;



void RegRun()
{
     system("C:/Users/RunOnce.reg");
}
void saymsg()
{
     cout<<"Did you press yes to edit the Registry this time?! y = 1  n = 2\n";
     cin>>x;
     cin.ignore();
}
void getinput()
{
    switch(x){
              case '1': break;
              case '2': askagain();
              break;
                   
              }
}
void askagain()
{
     cout<<"Would you like to try editing the registry again?? y = 1  n = 2\n";
                   cin>>y;
                   cin.ignore();
                   switch(y){
                             case '1': 
                                  RegRun();
                                  saymsg();
                                  getinput();
                             case '2': exit(0);      // want to make the program terminate... tried return 0 but it failed...
                             break;
                             default: cout<<"You entered A letter or character that is not in the menu";
                                      cout<<"Please try again!\n";
                                      askagain();
                             break;
                             }
                   }
void start()
{
     RegRun();
     cout<<"Did you press yes to allow registry editing?   y = 1   n = 2\n";
     getinput(); …
triumphost 120 Posting Whiz

Thank You GUYS! + Using Goto?
kk I have to give u guys credit where it is deserved... Honestly I've never came across any tutorials that show the compiler seeing a difference between '1' and 1...
Every tutorial I ever followed has always just put 1... So I never thought of it as a character... I just thought the compiler would actually see 1 as well 1 or the users input. anyway it works so thanks alot for that!! That really really really really HELPED A LOT! but I decided to go further and research why not to use goto and saw some places that its bad cuz it skips over lots of code and doesnt deconstruct properly?

So I decided to find a way to not use goto but I realize I cannot define a function inside of another function and now this is where I get stuck... It becomes a function loop and every function keeps asking me to define the one previous to it... here is what I mean:

#include <iostream>
#include "Windows.h"

using namespace std;
char x,y,z;

void try1()
{
     system("C:/Users/RunOnce.reg");
}
void saymsg()
{
     cout<<"Did you press yes to edit the Registry this time?! y = 1  n = 2\n";
     cin>>x;
     cin.ignore();
}
void try2()
{
    switch(x){
              case '1': break;
              case '2': try4();
              break;
                   
              }
}
void try4()
{
     cout<<"Would you like to try editing the registry again?? y = 1  n = 2\n";
                   cin>>y;
                   cin.ignore();
                   switch(y){
                             case '1': 
                                  try1(); …
triumphost 120 Posting Whiz

Neither of anyone's posts above helps.... if I change it to char, I get stuck in an infinite loop as it never accepts the numbers... choosing a letter also gives an infinite loop so thats a no go...


Thing with cases, if the user inputs a letter instead, it result in an infinite loop... lets say they do enter a number... example:
User presses 2 for first option, 1 for second option, the program does not go back to the cout<<"Allow me to edit registry\n";

here is the original code and what the program is supposed to do... It opens the browser and downloads an antivirus and its supposed to install it in trial mode...

#define _WIN32_WINNT	0x0500
#define _WIN32_IE		0x0500
#include <Windows.h>
#include <lm.h>
#include <assert.h>
#include <iostream>
#include <winuser.h>
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <shlobj.h>
#include <direct.h>
#include <windows.h>
#include <Shellapi.h>
#include <cstdlib>
#include <cctype>
#include <cmath>
#pragma comment(lib, "Netapi32.lib")

using namespace std;
char x,y,z;

int main(int argc, char *argv[])
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
    cout<<"Welcome to avast install helper... Some Parts are manually done! \n";
    Sleep(1000);
    cout<<"For CPU Speed Reasons, the browser will begin downloading a file in 20 Seconds!\n\n";
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
    cout<<"During the following Operations DO NOT TOUCH THE MOUSE/TRACKPAD!!\n";
    Sleep(5000);
    cout<<"Opening Default Browser and Downloading Torrent = Avast Pro AV 5.677\n\n";
    cout<<"Download Will begin 10 seconds after the browser has opened\n";
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
    cout<<"Dont touch the mouse!\n";
    Sleep(2000);

          HINSTANCE r = ShellExecute(NULL, "open", "
       
triumphost 120 Posting Whiz

KK the code below is a loop part of my main program I just cut it out and made it compilable.... This is the problem... When the user enters a number greater than 2, its supposed to tell them to retry because that was not in the options menu... that works... But the thing is if the user presses a LETTER or any other characters, it goes into an infinite loop and wont exit.... in other words when it does go to retry, the user is not given a second chance to choose, its like the letter gets stuck in the memory...

Note: I have tried if (isalpha()){ goto rtry; } and that did not work at all, instead it skips retry and just exits...

#include <iostream>
#include <windows.h>

using namespace std;

int x,y,z;

int main()
{
          tryagain:
                   cout<<"Allow me to edit registry\n";
		  rtry:
               Sleep(1000);
		  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
		  cout<<"Did You Press YES?!   1 = Yes I did , 2 = No I did not!\n";
		  cin>>y;
		  cin.ignore();
		  if (y == 1){
			  goto carryon;
		  }
		  else if (y == 2){
			  rtryloop:
			  cout<<"Would you like to allow the program to try editing the registry again?   1 = Yes , 2 = No, Just quit\n";
			  cin>>z;
			  cin.ignore();
			  if (z == 1){
				  goto tryagain;
			  }
			  else if (z == 2){
				  return 0;
			  }
			  else {
				  cout<<"You either pressed a number that is not on the menu, or a letter... Retry!\n";
				  goto rtryloop;
			  }
		  }
		  else {
			  cout<<"You either pressed a number that is not …
triumphost 120 Posting Whiz

Below has the source code to the program Im writing... anyway I want to do this... I want to be able to include a file from the project in my executable... Example: If I put the program on a different computer, I want it to able to open a file that came with it... *sigh* not sure how to explain it well but Ill try again...

My program has a custom registry file I made... I have the entire program in a folder on my desktop but In order for the program to run the registry file, I have to give it the location of it... I dont want to do that, I want to have the .exe file include the registry file merged into it like a zip folder sorta and then to use the registry file when the .exe is ran. In other words, I dont want to point the program to the registry file on the desktop (I want the program Independant) so If I put it on a different computer, itll be able to use the file... I basically want all my included files in the .exe kinda like how an installer uses its own files inside itself and loads it onto a computer?

Im using Dev C++

#define _WIN32_WINNT	0x0500
#define _WIN32_IE		0x0500
#include <Windows.h>
#include <lm.h>
#include <assert.h>
#include <iostream>
#include <winuser.h>
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <shlobj.h>
#include <direct.h>
#include <windows.h>
#include <Shellapi.h>
#include …
triumphost 120 Posting Whiz

Hey guys I found the following code snippet below... I want to know how to compile this... I am a c++ programmer and something is wrong with my mouse/audio so I thought this may programmatically solve it but I have no clue about anything java and in c++ there is no onmousemove or on mouse stop functions... I tried negating the movemouse event in c++ but its a no go and thats when I found the snippet below...

Can someone compile it because Im on a mac and I tried really hard to turn it into an executable for macs by typing:

cd ~/desktop
javac document.java

Note I did try putting these at the top as header files:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

It failed to compile with errors and I really cannot handle learning 3 languages... Objective-C, C++ and C# all at once... Or I would try learning java to get it to work.
This is not for any school projects or anything as Im taking mechanical engineering but I do programming in my spare time and right now Im trying to figure out the link between the audio on a computer and the trackpad... but im kinda stumped doing this in c++ but that java code below is exactly what I want it to do...


When the mouse is not moving, the program makes it go around in circles 5-7 pixel diameter... but when the …

triumphost 120 Posting Whiz

lol well I guess I gotta compile this in java then -_- time to hit the books and research and learn java better... hopefully I get it to compile or work or else i'd have to learn Objective c and reprogram my own audio driver...

Apparently this problem only happens on AMD processors as this only happened on the amd computers in my house... never happened on my intel computers and they're running the EXACT same os's... I tried reinstalling and seeing if it works but so far it happened on all amd computers...


Note: If i make the processor sweat/do a lot of work, the audio works fine... so I have a theory that the computer goes to sleep or the processor slows down when its not in use or no one is touching it... I tried turning sleep of and it still slows down and has the same problem but yet running programs run at the same speed... I guess when i touch the mouse the processor detects a human and plays audio lol... dont know why but even if I dont move the finger on the touchpad aka if I just leave a finger there without moving it, the audio still works perfectly... as long as the finger is there. it does not have to move but it has to be close to the touchpad or on it.

I guess I gotta go figure this stuff out on java on a mac …

triumphost 120 Posting Whiz

yeah I wanna move it programatically... thing is when I touch the pad sound works, if i move the usb mouse in circles, sound works... the second i stop either of them, the sound stops, slows down, or crackles...

my touchpad is heat sensitive aswell so If i put a coin or object on it, the sound will still be crappy but if I put my finger NEAR it or ON it, the sound quality increases dramatically...

I thought it was a driver problem since the sound works perfect in windows 7 but in xp or mac osx (hackintosh) tripple booting on the same machine, sound does not work well... XP = crappy sound, Mac = crappy sound, windows 7 = best sound I ever heard in my life.

I can already do those mouseevents and move the mouse to specific spots in c++ and stuff but I just cannot make it detect movements:

{
   If (Mouse not moving for 0.5s) 
    {
      run code
    }
   else if (Mouse moves for >= 0.5s)
     {
       stop running code
     }
}

and Repeat

triumphost 120 Posting Whiz

kk so I am having a problem on a mac where the audio doesnt work very well unless my finger is on the touchpad... it works perfectly smooth...


I want to write code to detect whether the finger is there or not and if it isnt then move the mouse x pixels and repeat until i actually touch the pad...


I found this in java that seems extremely relevant but Im not sure how to write this in c++ or if there is a better way to do it... currently im trying to do it in windows as I dont know yet how to program c++ on a mac or get it to run on a mac... I also heard objective c is for mac but Im sure c++ can work on it too... :S not sure where to start or how to do this in c++

document.onmousemove = (function() {
  var onmousestop = function() {
    /* do stuff */
  }, thread;

  return function() {
    clearTimeout(thread);
    thread = setTimeout(onmousestop, 500);
  };
})();

Code explanation:

Detects if the mouse is moving and does nothing if it is... but if the mouse has stopped for more than half a second, it executes the code and repeats until the mouse is moved.

triumphost 120 Posting Whiz
#include <assert.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <fstream>
#include <windows.h>
using namespace std;

int main ()
{
 string line;
    ifstream Dict ("C:/dictionary.txt"); //file to read
        getline (Dict,line); //get the current line
        ofstream ipDict;
        ipDict.open ("C:/dynamic-text.dat", ios::out | ios::app | ios::binary);
        ipDict << line <<" ";
        ipDict.close();      
    Dict.close();

return 0;
}

I fixed it like that... it works for me... I wanted to implement a way for users to point the program to their file but ill go search that up now.

triumphost 120 Posting Whiz
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;

int main () {
  string line;
  ifstream Dict ("C:/Users/Brandon/Desktop/Programs C++/Dictionary.txt"); //file to read
    ifstream file ("C:/Users/Brandon/Desktop/test.txt", ios::out | ios::app | ios::binary); //file to write

  if (!Dict.is_open()) { return -1; /*error */ };
  if (!file.is_open()) { return -1; /*error */ };

   while(!Dict.fail()){ //while we can read the file
      getline (Dict,line); //get the current line                   
      cout << line <<" "; //print line to screen
      file << line ; //write line to file
     }
  return 0;
}

Its not the error problem for my code... the thing is no matter what i cant get it to write to the file... Im actually trying to write it to a .dat file in binary mode but it wont write for some awkward reason!... I can write strings to the file, but I cant seem to get the Dictionary file to output its contents into the .dat file... aka test.txt


18 C:\Users\Brandon\Desktop\Programs C++\plswork.cpp no match for 'operator<<' in 'file << line'

triumphost 120 Posting Whiz

Ok here is what I want... I want to read the Dictionary file, and output its contents into the dynamic-text.dat file... But it reads the dictionary file and it will not write to the dynamic-text.dat file and I have no clue why... what am i doing wrong.. when I split the code, both files can be opened and written to, but when its like this, they will not read from one and write its contents to the other! =( Also If I altered the program to allow the user to input a string of words into the file, it will only input the first word.. anyone got any ideas?

#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;

int main () {
  string line;
  ifstream Dict ("C:/Users/Brandon/Desktop/Programs C++/Dictionary.txt");
  if (Dict.is_open())
  {
      getline (Dict,line);
      Sleep(1000);
            ifstream file ("C:/Users/Brandon/Desktop/test.txt", ios::out | ios::app | ios::binary);
               if (file.is_open())
               {
                 cout<< line <<" ";
               }
               else cout <<"Cannot Open 'File' for writing";
               file.close();
    Dict.close();
  }

  else cout << "Unable to open 'Dict' for reading"; 
  Sleep(5000);
  return 0;
}
triumphost 120 Posting Whiz

it finds the window and everything ive used spy++ to make sure i got the right window and stuff it just wont click the button.... is there a way to click the button using its handle? cuz there is the restore button as well which is actually the maximize button and then there is another button called restore but its actually to restore the phone itself...

so i wanted to know how to click a button using its handle.

triumphost 120 Posting Whiz

Can someone please tell me how to click a button using its handle?! Im confused... I have a button caption, i know its a button and i have its handle...

triumphost 120 Posting Whiz

SKIP to LINE 117

#include <iostream>
#include <windows.h>
#include <fstream.h>
#include <stdio.h>
#include <stdlib.h>


using namespace std;

char n , p , m , L , F , E;
int v , x , y , O , z , q , R;

int main()
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
    cout<<"This Program will help downgrade the iphone 3Gs provided you have an \n\n";
    cout<<"ECID/SHSH stored in cydia (open cydia & check). If not you are Out Of LUCK\n";
    cout<<"Check the top of cydia to see if you have one. Its written in green) \n\n";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
    cout<<"Please Answer the Following Questions: \n \n";
    cout<<"Have you edited the hosts file yet?    1 = Yes ... 2 = N \n";
    cin>> x;
    cin.ignore();
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
    cout<<"Are you using a Mac or a PC?    1 = Mac ... 2 = PC \n";
    cin>> y;
    
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
    if (x == 2 && y == 2)
    {
         fstream hosts;
         hosts.open("C:/Windows/System32/drivers/etc/hosts", fstream::out | fstream::app);
         hosts<<"\n74.208.10.249		gs.apple.com";
         hosts.close();
         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
         cout<<"Hosts file edited\n";
         cout<<"Are you Running Windows Vista/7?   1 = Yes ... 2 = No \n";
         cin>> z;
         if (z == 1)
         {
               cout<<"Is you Operating system 64x(x86) or 32 bit?\n\n";
               cout<<"1 = 64bit(x86)  ...   2 = 32 bit.. Enter your option now.\n";
               cin>> q;
         }
         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
               if (q == 1)
               {
                     cout<<"Now Running Itunes 64-bit(x86)\n";
                     system("start iTunes.exe");
               }
               else if (q == 2)
               {
                   cout<<"Now Running Itunes 32-bit\n";
                   system ("start iTunes.exe");
               }
               else
               {
                   cout<<"Now running iTunes for Windows XP\n";
                   system ("start iTunes.exe");
               }
         
    }
    else …
triumphost 120 Posting Whiz

lol wow what an intense book... in albanian and plus your actually gunna learn loops starting off with integrals oh man good luck in that class... when learning loops the first thing you learn it with is integers then variables not INTEGRALS that is something totally different and unless you know calculus, good luck lol, I guess i cant help cuz I cant read albanian but dam...

triumphost 120 Posting Whiz

If you tellme what exactly your math books says... or at least what the equation represents I can help you from there but just a picture isnt gunna cut it as I cant find that formula anywhere on google... Though just looking at it im pretty sure its one of Euler Maclaurin's summation formulas for polynomials..

I never would have guess but seems like you are doing intergrals of polynomials which means you want to do the anti-derivative... refer to calculus... so assuming that you are at that level and you know that a derivative is the "equation of the slope" of an equation at any given point... you want to go backwards... so that means you are given the "equation of the slope" and find the actual equation of the initial polynomial... This method is know as integrals... which is the same as finding the area under a graph such as a parabola so in this case physics and calculus can help you a lot... hope you took it in highschool...

triumphost 120 Posting Whiz
//Numbers where the 3rd number is the sum of the last two numbers infront of it...
//Example 1,1,2,3,5,8,13,21

#include <stdio.h>
#include <windows.h>

int main ()
{

     int num, t;
     double num1, num2, ans;

     num1 = 0;
     num2 = 1;

     printf("Enter the Amount Of Numbers You Want?\t");
     scanf("%d", &num);

     printf("1\t%.0f\n2\t%.0lf\n", num1, num2);

     for(t = 0; t < (num - 2); ++t){

          ans = (num1 + num2);

          printf("%d\t%.0lf\n", t+3, ans);

          num1 = num2;
          num2 = ans;
     }

  Sleep(10000);   
    return 0;
}
triumphost 120 Posting Whiz

adhruv92 First And Last Time: I did NOT do this to actually do you homework for you, the reason I actually did it was for a C++ refreshment in math, secondly I thought since no one else will actually help you, I can give you an idea of how it is done but this is NOT exactly the right code you are looking for... what you want is to implement loops such as if(P < 2000) { Interest = , Compounded= , Etc} else if (P > 2000) && (P < 6000) { BLAH BLAH BLAH } YES you will learn loops and c++ to finish your homework if you do need help post here but I will not continue the code any further unless you show that you understand it and can continue on your own with implementing the stuff you need it to do...

#include <iostream>
#include <windows.h>
#include <math.h>
#include <stdio.h>

using namespace std;

int main()
{
    float F, P, I, N , Y, power, Outside, U, TC;
    
    cout<<"Please Enter the Amount Of The Initial Deposit: \n";
    cin>> P;
    cout<<"Enter The Interest Rate: \n";
    cin>> I;
    cout<<"Enter The Number Of Time Compounded Per Anum: \n";
    cin>> N;
    cout<<"Enter The Amount Of Years The Deposit Will Be In The Bank: \n";
    cin>> Y;
    
    U = ((I/100)/N);
    I = (1 + U);
    TC = (N * Y);    
    power = pow(I, TC);
    F = (P * power);
    std::cout.precision(20);
    cout<<"The Final Amount Is: "<< F <<endl;
    Sleep(10000);
}

Release …

triumphost 120 Posting Whiz

Ok So Im writing a program to setup another program... And now Im stuck cuz I want make "my program" click the next button on the "setup" and then I want it to click the radio buttons on the "setup" program... how would I got about being able to send the right commands to the window... so far I have no clue but maybe these codes below will help me a bit?

// 1. activate an application using its handle

sk.AppActivate(hWnd);

// 2. activate an application given its window title

sk.AppActivate("Title");

/// 3. activate an application given either or both of its window title/class

sk.AppActivate(NULL, "TheClass"); // NULL means this criteria is not avail


// 4. via SendKeys method

sk.SendKeys("{appactivate Notepad}hello");