Anyone program C++ ?

For starters, something better then mircosoft visual basics for programming it.

Everytime i want to run my program, it says it has to build the tables...everytime.

I dont understand whats its doing and why. I just code the little bit i know and run.
 
can someone tell me why this program just ends with the Press any key to continue propt?

#include

#include

int numpen, numnic, numdim, numqua, numloo, numtoo;

float pen, nic, dim, qua, loo, too, total;

main ()

{

cout > numpen;

cout numnic;

cout numdim;

cout numqua;

cout numloo;

cout numtoo;

cout
 
My Dad is fucking amazing. He makes software so he can do anything. I believe he uses a program called Open C++.
 
apperently some of that code NS runs...

-#include

-#include

-

-int numpen, numnic, numdim, numqua, numloo, numtoo;

-float pen, nic, dim, qua, loo, too, total;

-

-main ()

-{

- cout > numpen;

- cout numnic;

- cout numdim;

- cout numqua;

- cout numloo;

- cout numtoo;

- cout
 
i have msn...

i think my program is fucked because it runs the program fine until i add a

cout endl;

it just stops the program and kills it, even after i remove that line
 
lets see if the fancy editor will let me show the code

#include

#include

using namespace std;

int numpen, numnic, numdim, numqua, numloo, numtoo;

float pen, nic, dim, qua, loo, too, total;

main ()

{

cout > numpen;

cout numnic;

cout numdim;

cout numqua;

cout numloo;

cout numtoo;

cout
 
its a money counting program

numpen is the number of pennies (int)

pen is the value of the pennies (float)
 
They arent connected...

I assign the value of pen using the cin for numpen * 0.01

I dont understand what you are saying.

My program crashes after i get all the number of coins...
 
ok, get rid of all the cin.precision(2).  Also you don't need math.h. What you do need to do is include iomanip and then use cout
 
Its been a while since I was well, forced to do this shit. Umm, don't you have to return 0 or return() at the end of it all? I don't know, maybe you don't because you didnt define your main, but that's how I always had to do it. Good luck.
 
oh shit. i never even saw that

and if you are using DEV C++ youre going to have to put a system pause in at the end...i forgot the syntax but i think its system("pause");
 
Well my visual bascis is back working properly now for some reason. Im happy though.
 
ps:

use Eclipse. A lot of companies tools based on it, so you might as well get used to it if you're serious about it. (IBM Webspehere, QNX Momentics and WindRiver Workbench, are based on it).
 
Ha, apparently I ending up catching that mistake? So why did I get a straight up D in that shit. Hmmm.
 
ya thats what i have...works pretty well except sometimes it wont let my programs run...anyone know about this problem?
 
This is a piece of code

cout name;

but it doesnt limit that string to 14 characters and it doesnt accept spaces.

So how do i make the cin.getline (name, 14) to work properly? It just skips the cin name phase, cout's the Next line, THEN it decides to allow me to type in but it doesnt assign it to the name varible.

Whats up?
 
I use DC++ on campus, its fuckin sick,, i dl a movice off someone in like a minute,, dls around 10mb/s lol
 
or you could put in the line while(cin.get() !='\n'); and it will eat up the input for the rest of the line no matter how long it is.
 
ok so i said fuck it and went with this

cout > name;

but since char name[15]; it waits till all 14 characters are taken up (which is a bunch of enters. how can i tell it to stop that shit and when they hit enter to move on?
 
Im frustrated beyonf belief at this shitty program.

Problem: After i input the employee number, its propts for the last name, which i type in but when i hit enter nothing happens. I can hit enter 100 times and nothing. It wont move onto the hottub question.

here it is in all its shittiness:

#include

#include

int tubs;

int id;

float salary;

char name[15];

main()

{

cout > id;

cout > name;

cout > tubs;

cout
 
It works for me. Note that I did comment out some lines. This is the code I used (in Visual Studio):

#include

"stdafx.h"

#include

#include

using namespace std;int

tubs;

int id;

float salary;

char name[15];int main()

{

cout > id;

cout > name;

cout > tubs;

//cout
 
that's strange,

trydoing a cin.ignore(1000,'\n')

after the first cin...

curious, does this work for you??

void main()

{

char name[15];

char c = 0;

int i = 0;

cout
 
so i finally got the programing working :D

apperently the lone problem was this line

cin.ignore('/n');

had to be switched to

cin.ignore(10, '/n');

program runs perfectly now (i dont need error checking on it yet)
 
Back
Top