• 0

need basic c++ help


Question

hey basically i want to make my 1 paged script run in command prompt (or with a gui if any of u can guide me) it works in the compiler (i used geany on ubuntu) i can get compilers for my vista machine (although il need your suggestions ... code blocks sucks on vista.. )

any way yea ... need my program to execute when clicked ... any help :) it wont execute at momment i must be doing something wrong.. as said it works when i run in compiler... i built it... compiled and ran it... but it wont work away from cmpiler ... im a noob at c++ but good at php so you dont have to dumb things down to retard level =] !! CHEERRSS

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

yea it works fine but it wont run out side of the compiler .. like on any pc... its just a calculator im making for a class that calculats vat ...

Link to comment
Share on other sites

  • 0

Well build it in "release" form and grab the exe

mind sharing some of the source to see if there is anything else that could be causing this?

Link to comment
Share on other sites

  • 0
Well build it in "release" form and grab the exe

mind sharing some of the source to see if there is anything else that could be causing this?

/*
 *	  vatcalc.cpp
 *	  
 *	  Copyright 2010 sam coleman 
 *	  
 *	  This program is free software; you can redistribute it and/or modify
 *	  it under the terms of the GNU General Public License as published by
 *	  the Free Software Foundation; either version 2 of the License, or
 *	  (at your option) any later version.
 *	  
 *	  This program is distributed in the hope that it will be useful,
 *	  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	  GNU General Public License for more details.
 *	  
 *	  You should have received a copy of the GNU General Public License
 *	  along with this program; if not, write to the Free Software
 *	  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *	  MA 02110-1301, USA.
 */

#include <iostream>

using namespace std;
double percentage;
double price;
int main ()
{
  cout << "enter the origanal price ";
  cin >> price;
  cout << "now enter percentage without the symbol % ";
  cin >> percentage;
  double divnum = percentage/100 + 1;
  double enprice = price/divnum;
  cout << enprice << " this is the new price with the percentage removed ";
  cout << "what happend was: ";
  cout << percentage << " was divided by 100 then 1 was add on ";
  cout <<" (to stop a negative number being the result) "
	   << "giving the result " << enprice;
  cout <<"then " << price << "was divied by the new number " << divnum;
  cout <<"which you see resulted in " << enprice;
  return 0;
  }

Link to comment
Share on other sites

  • 0
Make sure the build setting is set to release and create a .exe file, that should work

Are you compiling using gcc?

erm yes i think so... il boot up my ubuntu and get it going.. im not tht fresh with linux or compilers so lets hope i get it hey :D :p

Link to comment
Share on other sites

  • 0

i cnt tell if my build is set to release... like i said my compiler is geany in ubuntu and i can see any settings for it or anything like that..

Link to comment
Share on other sites

  • 0

The reason it's not working is because your program is a terminal based app. Double clicking on a terminal app like that in Ubuntu (Gnome) doesn't automagically open and execute it in a new terminal.

I am not sure how to make it spawn a new terminal and execute it but there's probably a way to do it.

Link to comment
Share on other sites

  • 0

It sounds to me like you may be having trouble just getting used to the Ubuntu way of running things.

this website: Compiling "C" and "C++" Programs on Linux - Ubuntu just might help you.

If I do recall, you have to use the terminal to run the file after your IDE compiles it and debugs.

I think the command to do that is "./MyCalculator" (without the quotation marks). Hopefully that page I sent can be of some help.

Best of Luck!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.