I was wondering if anyone could tell me what is a horribly formatted code and what are "well" formatted codes supposed to look like? What would make someone say the program is horribly formatted?...
Type: Posts; User: nadeera
I was wondering if anyone could tell me what is a horribly formatted code and what are "well" formatted codes supposed to look like? What would make someone say the program is horribly formatted?...
I have no idea what's wrong with this. It shows no error when it compiles but when I run it, it goes a little crazy.
14744
#include <iostream>#include <string>
using namespace std;
struct...
It's returning garbage values and I can't figure out why. It seems like there is something very simple I missed.
amountDue = amountDue1 + amountDue2 + amountDue3 + amountDue4;
This is basically what I want to do. If I initialize quantity[itemNumber] =0, I get error C2440: 'initializing': cannot convert from 'int' to 'double[8]'.
const int itemNumber = 8;
const...
I can't figure out how to solve this error, please help.
double price[itemNumber] = {10.50, 13.00, 10.50, 13.00, 8.50, 10.00, 11.50, 13.50};
double quantity[itemNumber];
double amountDue;
...
This is the code I have written so far.
#include <stdio.h>#include<math.h>
#define FINAL_EXPECTED 40.0
#define TOTAL_EXPECTED 100.0
struct result{
double final;
Okay, got it. What does this error mean and how to avoid it?
You used int main(void) instead of what I used which is main(). When should I use int main() and when to use main()? Except for return 0, I don't see much difference in them. Is it advisable to have...
Is that the same with this code?
struct result{
double final;
double midterm;
double labtest;
double quiz;
double assignment1;
double...
#include<stdio.h>
#include<math.h>
struct result{
double final;
double midterm;
double labtest;
double quiz;
double assignment1;
I'm going for a second attempt at my project. The system would allow Lecturer to Create a course marking scheme. A course marking scheme allows a lecturer to set the weightage of individual...
Oh, ok. So when do you suggest I use the if statement and when not to use it?
Okay. Will do.
Improvised version.
#include<stdio.h>
#define DOLLAR 100
#define QUARTER 25
#define DIME 10
#define NICKEL 5
main()
I tried writing the codes.
#include<stdio.h>
main()
{
int dollars = 0;
int quarters = 0;
int dimes = 0;
Thank you so much for this post. I finally got my enlightenment! It was definitely very helpful because I got to see the process of writing codes. I have a question, though. I am assuming that we are...
This is what I understand.
1. Total cents divide by 100 to get dollars.
2. The remainder is the cents.
3. The cents should be divided by 25 to get quarters.
4. After quarters is removed, the...
Noted Hodor. I will. Thanks. I understand how to convert the money into dollars and cents, but after that I have no idea how to break down the cents further into quarters, nickels, etc. That is my...
When cashiers in a store give you change they try first try to "fit" dollars into the amount you get back, then try to "fit" quarters (25 cent coins) into what is left over, they try to "fit" dimes...
Nope, I did not get any warnings. I changed it as you said, and now it works perfectly. Thank you so much. :D
Okay, but as soon as I convert everything it gives me a completely ridiculous answer. Is there anything I missed? Can you try running it, please?
#include<stdio.h>#define M_PI...
Yes, I am trying to do the exercises from that website. So I suppose coding this way, will do?
#include<stdio.h>#define M_PI 3.14159265358979323846
float square(float x);
main()
I came up with a new code. How do you use the function pi()? When do I use type double or type float?
#include<stdio.h>
float square(float x);
main()
{
Write a program that calculates the area of a circle from the radius. The radius will be an integer read in from the keyboard. You will need to use the function pi(). According to my understanding,...
This is sort of what I came up with for the lecturer's part.
#include<stdio.h>#include<string.h>
#include<conio.h>
struct lecturerData
{
char name[50];