My first application, try and suggest..  | | |
September 24th, 2004, 06:17 PM
|
#1 (permalink)
| | Senior Member
Join Date: Aug 2004 Location: LA, California
Posts: 812
| My first application, try and suggest..
It's so exciting, creating your first executable file. I made this program after teaching myself C++ basics. It is a simple application that took me about 10 minutes to write and about 10 more minutes to figure out why it wasn't working. I still couldn't figure out how to make it close out right, but you can just close it by clicking the cancel button. Now... How do I make a GUI for it? Anybody have any suggestions?
Here is the link if you would like to try my app. It is just a simple program that converts the temperature in Celsius (C) to Fahrenheit (F). Thanks
Here is the link. http://techknickle.tripod.com/thepicture.htm
__________________
People are like coins, there's always two sides.
Last edited by TechKnickle : September 24th, 2004 at 06:21 PM.
Reason: added link
|
| |
September 24th, 2004, 06:23 PM
|
#2 (permalink)
| | Not Really a Member
Join Date: Oct 2001
Posts: 25,401
|
You should post up the source, so people get a little better of a feeling that they can trust it even if it doesn't make much sense to them.
Congrats 
To get a GUI in winders your best bet is to get something like Visual C++
Not technically required, but takes out a LOT of the BS, its rather painful to write C++ guis by hand.
__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
|
| |
September 24th, 2004, 06:27 PM
|
#3 (permalink)
| | Senior Member
Join Date: Aug 2004 Location: LA, California
Posts: 812
|
Yea I was looking at Visual C++ but that costs a ton of money. I will just save up and get it eventually, I have seen that program before and have heard that it was the best for doing what I am looking to do. I had that program on my site last night, I will post the source at about 3:00 (The time I get home) so that you all can see it. Thanks again
~Tech |
| |
September 24th, 2004, 06:28 PM
|
#4 (permalink)
| | I am a banana!
Join Date: Jun 2002 Location: Texas Tech
Posts: 3,921
|
When you say visual c++, do you mean mfc?
here's a little clarification, visual c++ is just microsofts brand of c++, which is just normal c++ that comes with all of microsofts libraries, namely mfc and .net. If you can get the libraries (which isn't hard) borland and even cygwin (i think) can do everything visual c can. MFC is short for microsoft foundation classes and is basically a wrapper around the win32 API, which is the set of calls you make to do GUIs in windows. It is fairly complex with a very steep learning curve, but once you learn it it's actually very straightforward IMO. i like it better than MFC.
but i digress...if you want a GUI at your level you should just stick to visual basic or visual c#. doing GUIs in c++ is very difficult for a beginner. if you still want to try though, go to devcentral.iftech.com. they have some very good tutorials. you have to register, but it's free and i've never gotten any spam from them (or any e-mail at all for that matter).
Last edited by originel : September 24th, 2004 at 06:31 PM.
|
| |
September 24th, 2004, 06:56 PM
|
#5 (permalink)
| | Senior Member
Join Date: Aug 2004 Location: LA, California
Posts: 812
|
Cool, thanks Originel. I had that idea, and it really does look complicated, but I am determined and i do learn fast. Below is my source: Code: //
//Conversion Celsius to Fahrenheit by *ME (Name sensored for my privacy)
//
#include <iostream.h>
#include <stdio.h>
int main(int nNumberofArgs, char* pszArgs[])
{
//first statement
int nCelsius;
cout <<"Enter the temperature in Celsius:";
cin >> nCelsius;
int nFactor;
nFactor = 212 - 32;
int nFahrenheit;
nFahrenheit = nFactor * nCelsius/100 + 32;
//results
cout << "Fahrenheit value is:";
cout << nFahrenheit;
cin >> nCelsius;
}
|
| |
September 24th, 2004, 07:03 PM
|
#6 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Pasadena, CA
Posts: 2,177
| Quote: |
Originally Posted by vass0922 You should post up the source, so people get a little better of a feeling that they can trust it even if it doesn't make much sense to them.
Congrats 
To get a GUI in winders your best bet is to get something like Visual C++
Not technically required, but takes out a LOT of the BS, its rather painful to write C++ guis by hand. |
If its anything like writing Java GUI's then look out Getting all the grid-layouts and button placements in my simple 1 form java app was ridiculously tedious.
__________________
YAH! I knew you'd be jealous
|
| |
September 24th, 2004, 07:28 PM
|
#7 (permalink)
| | may contain mild peril
Join Date: Oct 2001 Location: UK
Posts: 3,329
|
I am don't write much C++ but a few things spring to mind... Code: #include <iostream> // no need for the .h in C++
int main()
{
float tempCel;
std::cout << "Enter the temperature in Celsius: ";
std::cin >> tempCel;
float tempFar = (1.8 * tempCel) + 32; // can't remember if this is correct
std::cout << "Fahrenheit value is: ";
std::cout << tempFar << std::endl;
return 0; // main should return an int
}
I am sure some of the C++ guys can chime in and add something more useful
Regards
ed |
| |
September 24th, 2004, 08:13 PM
|
#8 (permalink)
| | Member
Join Date: Jan 2004
Posts: 242
|
yea i dont think the header needs the .h unless you wrote that library and it would have " " instead of < >.
this is how i had to write the header on some basic c++ but it was using unix...dunno how different the code would be.
#include<iostream>
#include<string>
#include<cstdlib> //provides EXIT_SUCCESS
using namespace std;
int main(){
...
...
return EXIT_SUCCESS;
}
i think that the "EXIT_SUCCESS" should exit the program correctly |
| |
September 24th, 2004, 08:45 PM
|
#9 (permalink)
| | Senior Member
Join Date: Aug 2004 Location: LA, California
Posts: 812
|
Ok thank's for the input. I wasn't sure if I had to include .h for my header files, but now I know
I was going to put in some floating point characters to make the output more accurate.
How can I loop it? LIke if they want another number to be entered how do I go back to my first cin?
Also, I made it close correctly by removing the last line asking for the cin again and putting a
return 0;
there instead
Last edited by TechKnickle : September 24th, 2004 at 08:50 PM.
|
| |
September 24th, 2004, 08:49 PM
|
#10 (permalink)
| | Member
Join Date: Jul 2004 Location: Batavia, Ohio, USA
Posts: 35
|
If you wanna loop it, you have to start a loop, put the code there, check to see if the first number equals a certain number wanting to exit, if not, continue.
From using SpookyEddy's code, it's something like this: Code: #include <iostream> // no need for the .h in C++
int main()
{
int a = 0;
while ( a == 0 ) //beginning never-ending loop
{
float tempCel;
std::cout << "Enter the temperature in Celsius: ";
std::cin >> tempCel;
if ( tempCel == 0 )
{
return 0;
}
float tempFar = (1.8 * tempCel) + 32; // can't remember if this is correct
std::cout << "Fahrenheit value is: ";
std::cout << tempFar << std::endl;
}
return 0; // main should return an int
}
Last edited by Nightfire : September 24th, 2004 at 08:56 PM.
|
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |