Thread: making a window program

  1. #1
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29

    making a window program

    any easy tutorials which teach u how to make a window math program from scratch?
    Last edited by DDX; 03-19-2005 at 03:17 PM.

  2. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Venture into the world of Win32 API

    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #3
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    ill start reading it but its a window(not bill gates windows) application not console application right?

  4. #4
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    #include<windows.h>

    This is not a DOS console application.. It's a pretty good tutorial about how to create a basic window using the Windows32 API. Basically, you'll set a bunch of attributes of a windows structure.. and register it with windows. Windows will interact with your program by sending messages to your program (in the form of WM_Message) which you will handle using a swtich/case structure.

    Examples:

    If the window is being resized, windows will issue WM_SIZE and WM_REPAINT messages

    If the user clicks the red X, windows will issue a WM_DESTROY message


    it's up to your program to handle these messages and react accordingly
    Last edited by The Brain; 03-19-2005 at 03:33 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  5. #5
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    Aha....i understood everything u said.....i hope ill manage to get something outta it.
    k ........ myself......im too stupid...i tried understanding the whole thing since last 2 months when i heard about such thing and i wont understand now either......well ill go jump off a cliff
    Last edited by DDX; 03-19-2005 at 03:30 PM.

  6. #6
    Registered User
    Join Date
    Feb 2003
    Posts
    62
    LOL I look forwad to your post, cause you really cheer me up!
    Thanks,

    By the way I am curious if you can't programme, why are you trying to write a windows programme? I mean you need to know how to write console programmes first and your trying to write something more advanced.

  7. #7
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    i just need a window program and im trying to learn but i get the first 3 tuts ut dunno what to do then....i just cant get it and im trying.

  8. #8
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    hmm k heres a tough one.
    whats the code to make a console app know some aquivalents like this
    7ap = 7p , p = 0,50

    and what if i want to remember more than 1 aquation?
    like
    7*a*p = 7*p , p = 0,50
    5*b*q = 5*q , q = 0,40
    5*c*e = 5*e , e = 0,70
    Last edited by DDX; 03-19-2005 at 03:52 PM.

  9. #9
    Banned
    Join Date
    Oct 2004
    Posts
    250
    I dont get it what are you trying to write? a calculator ? if you have msn add me [email protected] i have some good WIN32 calculator examples that you might want.

  10. #10
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I suspect it has something to do with this.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  11. #11
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    dont bother i managed to make this program

  12. #12
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29

    next problem

    well the code has a problem and i cant find out what, pls HELP me fix it:
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
       double operand1;
       double operand2;
       double operand3;
       double operand4;
       double operand5;
       double difference1;
       double difference2;
       double difference3;
       double difference4;
       double sum1;
       double sum2;
       double sum3;
       double sum4;
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Brezeln ein:\n";
       operand1 = readDouble();
       difference1 = (7 - operand1);
    
       printLine<<"Geben Sie bitte der Anzahl der übrig gebliebene Laugenbrötchen ein:\n";
       operand2 = readDouble();
       difference2 = (5 - operand2);
    
       printLine<<"Geben Sie bitte der Anzahl der übrig gebliebene Käsestangen ein:\n";
       operand3 = readDouble();
       difference3 = (5 - operand3);
    
       printLine("Geben Sie bitte der Anzahl der übrig gebliebene Laugencroissants ein:\n";
       operand4 = readDouble();
       difference4 = (5 - operand4);
       sum1 = (difference1 + difference2 + difference3 + difference4);
    
       printLine("Geben Sie bitte Kassenstand am Ende in € ein:\n";
       operand5 = readDouble ();
    
       
       double product1 = (difference1 * 0.50);
       double product2 = (difference2 * 0.40);
       double product3 = (difference3 * 0.70);
       double product4 = (difference4 * 0.65);
       sum2 = (10 + product1 + product2 + product3 + product4);
       sum3 = (operand1 * 0.50 + operand2 * 0.40 + operand3 * 0.70 + operand4 * 0.65);
       sum4 = (7 * 0.50 + 5 * 0.40 + 5 * 0.70 + 5 * 0.65 + 10);
       printLine("Kassenstand wenn alles verkauft worden sein würde:         " +sum4);
       printLine("So viel Geld müssen Sie in die Kasse haben:                        " +sum2);
       printLine("Preis der übrig gebliebene Waren:                                            " +sum3);
       printLine("Aktuelle Kassenstand am Ende:                                                " +operand5);
    if(operand5 < sum2){
       printLine ("Gewinn oder Verlust:                                                                   -"+(operand5 - sum2));
    }
    if(operand5 > sum2){
       printLine("Gewinn oder Verlust:                                                                    +"+(operand5 - sum2));
    }
    if(operand5 == sum2){
       printLine("Gewinn oder Verlust:                                                                     "+(operand5 - sum2));
    }
    
    }

  13. #13
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    Im not an expert, and i dont know german, but from what i can tell you are trying to get the user to input a number and subtract the number from sever or whatever ... you could have :

    Code:
    cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Brezeln ein:\n";
       cin >> operand1;
       difference1 = (7 - operand1);
    i've never heard of readDouble() function in <iostream>

    and also:
    Code:
    printLine<<"Geben Sie bitte der Anzahl der übrig gebliebene Laugenbrötchen ein:\n";
    i've never heard of printLine, hoever maybe you got confused with the "printf" from C

    you can use 'cout'



    i fixed it up for you:

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
       double operand1;
       double operand2;
       double operand3;
       double operand4;
       double operand5;
       double difference1;
       double difference2;
       double difference3;
       double difference4;
       double sum1;
       double sum2;
       double sum3;
       double sum4;
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Brezeln ein:\n";
       cin >> operand1;
       difference1 = (7 - operand1);
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Laugenbrötchen ein:\n";
       cin >> operand2;
       difference2 = (5 - operand2);
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Käsestangen ein:\n";
       cin >> operand3;
       difference3 = (5 - operand3);
    
       cout << "Geben Sie bitte der Anzahl der übrig gebliebene Laugencroissants ein:\n";
       cin >> operand4;
       difference4 = (5 - operand4);
       sum1 = (difference1 + difference2 + difference3 + difference4);
    
       cout << "Geben Sie bitte Kassenstand am Ende in € ein:\n";
       cin >> operand5;
    
       
       double product1 = (difference1 * 0.50);
       double product2 = (difference2 * 0.40);
       double product3 = (difference3 * 0.70);
       double product4 = (difference4 * 0.65);
       sum2 = (10 + product1 + product2 + product3 + product4);
       sum3 = (operand1 * 0.50 + operand2 * 0.40 + operand3 * 0.70 + operand4 * 0.65);
       sum4 = (7 * 0.50 + 5 * 0.40 + 5 * 0.70 + 5 * 0.65 + 10);
       cout << "Kassenstand wenn alles verkauft worden sein würde:         " + sum4;
       cout << "So viel Geld müssen Sie in die Kasse haben:                        " + sum2;
       cout << "Preis der übrig gebliebene Waren:                                            " + sum3;
       cout << "Aktuelle Kassenstand am Ende:                                                " + operand5;
    if(operand5 < sum2){
       cout << "Gewinn oder Verlust:                                                                   -" + (operand5 - sum2);
    }
    if(operand5 > sum2){
       cout << "Gewinn oder Verlust:                                                                    +" + (operand5 - sum2);
    }
    if(operand5 == sum2){
       cout << "Gewinn oder Verlust:                                                                     " + (operand5 - sum2);
    }
    
    }

    but here there is big problem.. you can not add a string to a number:
    Code:
    cout << "Kassenstand wenn alles verkauft worden sein würde:         " + sum4;
       cout << "So viel Geld müssen Sie in die Kasse haben:                        " + sum2;
       cout << "Preis der übrig gebliebene Waren:                                            " + sum3;
       cout << "Aktuelle Kassenstand am Ende:                                                " + operand5;
    if(operand5 < sum2){
       cout << "Gewinn oder Verlust:                                                                   -" + (operand5 - sum2);
    }
    if(operand5 > sum2){
       cout << "Gewinn oder Verlust:                                                                    +" + (operand5 - sum2);
    }
    if(operand5 == sum2){
       cout << "Gewinn oder Verlust:                                                                     " + (operand5 - sum2);

    maybe you are trying to get a number input and then add the thing to the number.. or something..

    EDIT:

    you dont need 'double' since you are only working with whole numbers.. you might want to use 'int'
    Last edited by mrafcho001; 03-20-2005 at 12:12 PM.

  14. #14
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
      int a;
      int b;
      int c;
      int d;
      int e;
      int f;
      int g;
      int h;
      int i;
      int j;
      int k;
      int l;
      int m;
      int n;
      int o;
      int p;
      int r;
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Brezeln ein: ");
       n = 7 - e;
       cin.ignore();
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Laugenbrötchen ein: /n");
       o = 5 - f;
       cin.ignore();
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Käsestangen ein: /n");
       p = 5 - g;
       cin.ignore();
    
       cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Laugencroissants ein: /n");
       r = 5 - h;
       cin.ignore();
       j = n + o + p + r;
       cin.ignore();
    
       cout<<"Geben Sie bitte Kassenstand am Ende in € ein: /n");
    
    
       a = n * 0.50;
       b = o * 0.40;
       c = p * 0.70;
       d = r * 0.65;
       k = 10 + a + b + c + d;
       l = e * 0.50 + f * 0.40 + g * 0.70 + h * 0.65;
       m = 7 * 0.50 + 5 * 0.40 + 5 * 0.70 + 5 * 0.65 + 10;
    
       cout<<"Kassenstand wenn alles verkauft worden sein würde:         " +m ;
       cout<<"So viel Geld müssen Sie in die Kasse haben:                        " +k ;
       cout<<"Preis der übrig gebliebene Waren:                                            " +l ;
       cout<<"Aktuelle Kassenstand am Ende:                                                " +i ;
       if( i < k ){
       cout<<"Gewinn oder Verlust:                                                                   -"+( i - k ;
    }
       if( i > k ){
       cout<<"Gewinn oder Verlust:                                                                    +"+( i - k ;
    }
       if( i == k ){
       cout<<"Gewinn oder Verlust:                                                                     "+( i - k ;
    }
    )
    well i fixed some of my own . but can uy fix it right i get some errors i dont know how to fix when compiling.
    all i want is that this console application lets the user input a number and thats the number from right...i under lined it .
    'cout<<"Geben Sie bitte der Anzahl der übrig gebliebene Brezeln ein: ");
    n = 7 - e;
    cin.ignore();'
    from there to the next code the user inputs a number
    and the program displays from
    Code:
     cout<<"Kassenstand wenn alles verkauft worden sein würde:         " +m ;
    to the bottom.
    i owe you.......thx for helping me out....u have no idea how thankfull i am

  15. #15
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    and the program needs to calculate all that and display result i want it to from cout<<"Kassenstand wenn alles verkauft worden sein würde: " +m ; to the bottom....thx again........ver very much!ure very kind

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  2. Create a Program with no window
    By brconner in forum C++ Programming
    Replies: 8
    Last Post: 05-27-2007, 01:26 PM
  3. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 12:31 PM
  4. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  5. Making dialog box the only window
    By PJYelton in forum Windows Programming
    Replies: 2
    Last Post: 09-06-2005, 12:02 PM