|
I did give it a shot but the only things thats outputs is the metric ton and not the bottles, here is the program....what am i doing wrong here....
#include <iostream.h>
int main()
{
int ale, bottles, sum, sum1; // declaration
cout << "Weight of bottle of ale in ounces\n"; // prompt at Screen
cin >> ale;
sum = (ale/35273.92);
cout << "Weight of Ale in metric tons is" << sum << endl;
cin >> bottles;
sum1 = ((ale/35273.92) / 35273.92);
cout << "Number of bottles needed for 1 ton of ale are" <
|
|
|
|
|
Atika Khan wrote:
cin >> bottles;
you're waiting for input
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
the Output always gives me 0 bootles, Am I doing the calculation wrong for getting the number of bottles???
|
|
|
|
|
yes. (oz/ton)/(oz/bottle) = bottle/ton
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
Thank you very much brian
|
|
|
|
|
Whatever happened to math skills.. no offence.
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
Reminds me of the post a few days back about the significance of math skills in the programming field.
Oh well.
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
no problem, but for future reference, some people around here aren't quite so forgiving. It is after all a programming forum, and not math.
In any case, Good Luck with the C++!!
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
With the risk of being shot by Microsoft or a Java Guru, how do you think that programming has evolved the last 2 years?
Is the majority of applications still written in C/C++ (or even Cobol) or is anyone switching to VB or C#?
And what about Java? Are stilly many programmers switching to Java or has the migration stopped since the burst of the .com bubble?
Does anybody of you know if there any inquiries or reports that can be found on sites?
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
I want to write a small program that copies files to couple directory including Program Files. Is there a function that returns the Program Files location? If there are 2 hard drives and both of them have Program Files folder, which one is returned?
|
|
|
|
|
SHGetSpecialFolderPath.. with
nFolder as CSIDL_COMMON_PROGRAMS, -- look in MSDN.
I think there is only ever 1 real Program Files folder?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
And another way is to get the environement variable named ProgramFiles by just using getenv("ProgramFiles").
But i guess the first method is better
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
If there are 2 hard drives and both of them have Program Files folder, which one is returned?
The one returned by getenv
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
From the registry. Here's a snippet
const char FilesSection[] = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion";
const char FilesItem[] = "ProgramFilesDir";
char FilesPath[MAX_PATH] = {0};
DWORD size = sizeof(FilesPath);
if(!REG_Get(HKEY_LOCAL_MACHINE, FilesSection, FilesItem, FilesPath, &size))
return(FALSE);
char Temp[MAX_PATH] = {0};
if(!ExpandEnvironmentStrings(FilesPath, Temp, sizeof(Temp)))
return(FALSE);
Todd Smith
|
|
|
|
|
Be warned though you cannot write anything in the Program Files directory if you are running XP, depending on the user profile.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Im writing an MDI app, and I dont want the application to create / show a blank document when the application starts. I know that ProcessShellCommand calls either OnFileNew or OpenDocumentFile (depending on wether a file was specified in the command line). What can I do?
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
In your app's InitInstance, you should see some code like this:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
</code>
Add this line to it:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
return FALSE;
</code>
By default, m_nShellCommand is set to FileNew, which creates a new document for you automatically when the app starts.
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
Perfect Thanks...
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
arg.. i tried to replace my bitmap resource for my toolbar and now i crash everytime i get to the last line in red below.. can someone tell me what might cause SetBitmap() to crash like it is now?
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
HBITMAP hBmp = static_cast<HBITMAP>(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_SCTOOLBAR),
IMAGE_BITMAP, 0, 0, LR_SHARED | LR_LOADMAP3DCOLORS));
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | BTNS_SHOWTEXT | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1;
}
<code>m_wndToolBar.SetBitmap(hBmp);</code>
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
the problem is specifically this line:
HBITMAP hBmp = static_cast(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_SCTOOLBAR),
IMAGE_BITMAP, 0, 0, LR_SHARED | LR_LOADMAP3DCOLORS)); this function is setting hBmp to NULL now.. i have tried exporting from photoshop in 256 color, 16 bit, and 24 bit.. all of them crash.. any suggestions? basically all it is is a high color bitmap for my toolbar..
thanks in advance..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
I want to callback a vc function from my VB com dll. How do I pass the address of this vc function to my dll?
Thanks,
ns
|
|
|
|
|
I want to track the progress of my function. It does 4 distinct 'jobs'. How exactly do I convert the time taken in doing these steps into the progress bars progress?
Thanks,
ns
|
|
|
|
|
u can use a time span CTimeSpan to calculate the time, then Step the progress accordingly, after few test, ull have a good statistic in order to smooth the progress appearence
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I've got a desktop application in development in VC++ 6 that processes data and creates an SVG file that can be seen in a local html file that was built to show the SVG file and some supporting info. No network connection needed, no server, just local desktop.
What I would like to be able to do is to use the Adobe SVG viewer as an ActiveX control to read the SVG file and do the rendering, but instead of displaying the SVG in the application, I need to be able to access the rendered bitmap and operate on the individual pixels. Even converting the SVG into a JPG would allow me to use the CxImage or FreeImage library to read the JPG file and have access to the individual pixels.
A search on Google provides many hits on converting SVG into JPG, but they're all Java, and that won't cut it. I need some C++ code.
Has anyone done something like this that would be able/willing to share some code to get me started, or point me in the right direction? I need to be able to load, create, and manipulate the SVG ActiveX control in a non-visible manner, and I need access to the rendered bitmap.
Thanks,
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
You might get something usable from libSVG.
|
|
|
|