• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

I HATE PROGRAMMING NEED QUICK HELP!!!!!

thespeakerbox

Platinum Member
I downloaded bloodshed, cause my moron teacher didnt give us anything to go by.
The first day of class and she hands out a paper that says
"write a program to calculate the volume of a box"

I cant get the program to work at all.
I named it a .c file and when i hit compile & run a blank screen comes up.
This is what i have so far.

CAN SOMEONE HELP ME!!!

/*Homework assignment 1 */
/*Compute the volume of a box*/
#include <stdio.h>
void main()
{
int length, width, height;
int volume;
scanf ("%d", &length),
scanf ("%d", &width),
scanf ("%d", &height),
volume= length * width * height;
printf("volume=%d \n ", volume);
}
 
Originally posted by: AgentEL
wrong forum and you have commas instead of semicolons. how did this compile?

A comma is a valid operator in C. It has very low precedence. On each side of a comma is an expression and the value of the operation is the value produced by the last expression. The code as shown probably will compile (at least the comma won't produce a compilation error). Is it possible that you're just getting a blank screen because it's waiting for you to enter the data that you're prompting for in the scanf statements?
 
^ is right. For clarity Why don't you put some printf's before the scanf's, asking the user for the length / width / height.
 
Originally posted by: JohnCU
don't you need a SYSTEM("PAUSE"); in there to see the results?

You could run it from a command prompt only, and the result would be there to see. (but your solution is much better).

Anyway, you need to put some printf to explain to the idiot^G^G^G^G^G user what he needs to do.
 
don't take a class in programming? it's teachers like yours that prevented many of my friends from pursuing compsci.
 
Originally posted by: tami
don't take a class in programming? it's teachers like yours that prevented many of my friends from pursuing compsci.

It is not always the teachers. Many times it is stdents that can not grasp and visualize simple problems.

 
Originally posted by: EagleKeeper
Originally posted by: tami
don't take a class in programming? it's teachers like yours that prevented many of my friends from pursuing compsci.

It is not always the teachers. Many times it is stdents that can not grasp and visualize simple problems.

like the one that OP posted.

that is easier than 8th grade algebrae.
 
Originally posted by: EagleKeeper
Originally posted by: tami
don't take a class in programming? it's teachers like yours that prevented many of my friends from pursuing compsci.

It is not always the teachers. Many times it is stdents that can not grasp and visualize simple problems.

this is true. in my particular case, the professor was forced to resign since there were so many complaints about him. :Q
 
Originally posted by: thespeakerbox
I downloaded bloodshed, cause my moron teacher didnt give us anything to go by.
The first day of class and she hands out a paper that says
"write a program to calculate the volume of a box"

I cant get the program to work at all.
I named it a .c file and when i hit compile & run a blank screen comes up.
This is what i have so far.

CAN SOMEONE HELP ME!!!

/*Homework assignment 1 */
/*Compute the volume of a box*/
#include <stdio.h>
void main()
{
int length, width, height;
int volume;
scanf ("%d", &length),
scanf ("%d", &width),
scanf ("%d", &height),
volume= length * width * height;
printf("volume=%d \n ", volume);
}

of course it'll be a blank screen, you are asking the computer to read the user input without asking the user for the input.

this should do it

/*Homework assignment 1 */
/*Compute the volume of a box*/
#include <stdio.h>
void main()
{
int length, width, height;
int volume;
printf("Please enter length, width, and height of the box...\n");
scanf ("%d %d %d", &length, &width, &height);
volume= length * width * height;
printf("volume=%d \n ", volume);
}
 
Er, i figured it out this morning , but thanks for all the help.

Well the story goes that the teacher never ordered our books for the bookstore, and she never wrote anything on the board (Too fat to get up). So we basically had to imagine how everything would look. It was more of a Research assignment. Like, HOW TO GOOGLE "OH MY GOD IM GONNA FAIL C CAUSE MY TEACHERS SO FAT PLEASE LORD TEACH ME CODE"

You get the feel...
 
Back
Top