C++ ::  Looping Simple Menu - Calculate Dimensions Of Floor Plan In Square Feet?

Oct 2, 2013

What I'm trying to accomplish is to ask the user what their floor plan is (in square feet), have them pick what kind of material they want and give them a general price.

Which is working out great so far, but I would also like to add a loop at the end that cycles back if they want to re-do the estimate with a different material selection and if not exit out the program.

I've been trying do while and if/else loops but i can't get them to work right.

#include <iostream>
#include <string>
using namespace std;
int main() {
string custName, selection;
int custNumber, floorSize, material, contactSystem;

[Code] ....

That's basically what I've come up with so far minus all the erroneous attempts. Though as is I technically complete the assignment, I would like the extra credit from making the last part loop.

View 1 Replies


ADVERTISEMENT

C++ :: Calculate Dimensions Of A Circle?

Jul 3, 2013

Code:

#ifndef CIRCLE_H
#define CIRCLE_H
class Circle {
public:
//constructors
Circle();
Circle(double r);

[code]....

The function isBigger() returns true (or false) if the radius of the Circle instance on which the function is invoked is bigger (or smaller) than the radius of the Circle instance passed to the function.: How to implement this function?

View 5 Replies View Related

C :: Input Matrices Dimensions - Calculate Elements Of Products

Nov 14, 2013

This is my code and it's not giving me the right output

Code:
#include <stdio.h>
int main() {
int dim;
int i, row, col;
// inputting matrices dimensions
int M0, M1, M2;

[Code] ....

The output should give me this:
Input 2
Correct Output 2 5 4 10

View 10 Replies View Related

C++ :: Looping And Calculate The Percentage?

Mar 7, 2013

#include <iostream>
#include <iomanip>
#include <math.h>

[Code].....

I AM HAVING TROUBLE CALCULATING THE PERCENTAGE. I HAVE TO CALCULATE THE AMOUNT OF MONEY FOR 6 YEARS.

View 1 Replies View Related

C/C++ :: Trying To Draw A Grid In A Square For Simple Checkers Game

Oct 7, 2014

I am trying to draw a grid for checkers. I could draw a square at the starting point from origin with the code below(attached the pic below how it looks) however I am not being able to draw a grid when the program runs.

#include "ccc_win.h"
// GameDemo.cpp
// Shows how to place a piece accurately on a grid after a mouse click.
#include "ccc_win.h" // for graphics classes and functions
using namespace std;
int ccc_win_main(void) // main function for graphics program

[Code] ....

View 3 Replies View Related

C++ :: Simple Program To Display Menu With Options

Mar 23, 2014

I decided to create a simple program to display a menu with options, while that is easy enough I had some difficulty when selecting an option that has options inside which also has an option again. While I had many issues in the past I'm finally finished with it and it works fine, but being new to programming and not knowing various other methods available.

Code:
//:::::::::::::::::::::Simple Menu Program::::::::::::::::
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#include <iostream>
#include <string>

//function prototypes

[Code] .....

View 1 Replies View Related

C++ :: Login System And Simple Menu With 3 Options

Oct 16, 2013

I need a program that has a login system and then a menu that has 3 options: Add, delete and exit. If I choose Add it wil ask for certain data of 5 students.

Then after registering the 5 students, another menu with the options: Search, Delete and exit. In search it will ask for an ID and then prints all the data of a single student. Delete gives me the option to delete the data of any user I choose.

View 1 Replies View Related

C++ :: Simple Game Menu - Program That Simulates Handheld Gaming System

Sep 26, 2013

I have to write a program that simulates a handheld gaming system. a system can have power toggled so its either on or off. when the system is on, its volume level can be raised or lowerd. a system has minimum volume level of zero and a maximum volume level of 10. a system stores games.

// simple game menu
//simulates a handheld gaming system
using namespace std;
class Game {
public:
Game(int GameNumber = 3, int volume = 10);

[Code] .....

View 1 Replies View Related

C++ :: User Input Two Numbers - Calculate Square Root Then Roots Are Added Up To Return Sum

Aug 23, 2014

I have tried writing a code which takes two numbers from the user and calculates their square root then the roots are added up to return the sum. The program is coming out with loads of errors.

#include<iostream>
#include<cmath>
float main(){
using namespace std;
float m1,m2,m3,m4,m5;

[Code] ....

View 4 Replies View Related

C :: Calculate Offset Of Simple Program

Sep 28, 2013

I would to learn how could i calculate the offset of simple c program?

Lets say that I have that simple program:

Code:
#include <stdio.h>
int main() {
int x=1;
printf("x = %d", x);
return 0;
}

View 9 Replies View Related

C++ :: Calculate Simple Interest Using Functions

Jan 17, 2013

I was trying to make a program of calculating simple intrest using functions. I don't know whats wrong with the program but it always shows a wrong output.

#include<iostream.h>
#include<conio.h>
float si(int p,int r,int t) {
return ((p*t*r)/100.0);

[Code] ....

View 4 Replies View Related

C++ :: Calculate Simple Interest Of Given Loan Amount And Duration In Years

Jan 25, 2013

Your objective is to write a program that calculates the simple interest for a given loan amount and duration (in years).

Formula:

Simple interest = loan amount X interest rate X number of years
Assume interest rate is a constant 6% per year.

Specifically, your program will:
1. Output descriptive header
2. Prompt and read any customer’s first name, middle initial, and last name individually
3. Prompt and read the principal/loan amount
4. Prompt and read the duration of the loan in years
5. Calculate the interest
6. Output:
a. Customer full name
b. Principal/loan amount
c. Duration of loan
d. Interest rate
e. Interest on loan
f. Principal and interest due at end of term

OK SO THIS IS MY PROGRAM SO FAR. As you can see i got it all but i am so confused with as to for loan amount and duration of year, if i should use float or double to declare it?

i need to finish this assignment by calculating the simple interest and i dont know how or where to begin.

int main(){
system("color f0");
string firstName;
string middleInitial;
string lastName;
cout<<"Please enter your First Name: ";

[Code]...

View 1 Replies View Related

C++ :: Customers Plan - Output Name And Two Digit Number Next To It?

Nov 8, 2013

//using bloodshed dev c++ compiler
//How can I output the name and a two digit number next to it
//example would be Indiana Jones 20
#include<iostream>
#include<string>
using namespace std;
class Customer {

[Code] .....

View 3 Replies View Related

C++ :: Program And Simulate 2 Floor Lift Control System?

Apr 28, 2014

I need to program and simulate a 2 floor lift control system. How to do that ? I need to design its program only.

View 1 Replies View Related

C/C++ :: Displaying Filled Square Next To Hollow Square?

Feb 28, 2015

I am able to display a filled and hollow square by themselves, but I can't seem to be able to get them side by side.

So this is my code so far:

[/
#include <iostream>
using namespace std;
int main()

[Code]....

I can get the hollow square to show up, but the first square just shows up as a single line instead of a square. It seems that it ignores the first if statement in the second loop. I've tried not using an if statement in the second loop but it didn't seem to work either.

View 4 Replies View Related

C++ :: Draw A Square Within A Square Pattern

Oct 25, 2013

I know how to draw a square hollow or filled but i need to draw an alternating pattern ....

ex
iPatternHeight = 1
X

iPatternHeight = 3
OOO
OXO
OOO

[Code] .....

View 6 Replies View Related

C++ :: Menu Program Broken Down Into Series Of Calls To Function For Each Of Menu Items

Aug 19, 2013

I am trying to write a menu program that will be broken down into a series of calls to function for each of the menu items. Two of the menu items will be simple programs which I wrote.

I want two of the functions to run one of the two programs I am trying to include as items in the menu.

So far I am only familiar with variables, loops, if statements, and I just learned how to write functions.

The problem I am have is that I don't quite understand how to write a function that will run one of the two programs. Also I am having a hard time writing the program in away that would allow the user to select the menu items.

View 2 Replies View Related

C :: Program Based On Menu System - Option To Go Back To A Previous Menu

Apr 7, 2014

I'm creating a program that is based on a menu system. Basically each menu is its own user-defined function. The problem is at each menu you can input 'b' to go to the previous menu. I just have it call the function of that menu.

However, do the functions need to complete themselves eventually? If I just keep calling functions will I just keep going further and further deeper into ever running functions?

If so how do I avoid this and yet keep the option to go back to a previous menu/function?

View 2 Replies View Related

C++ ::  Converting Feet To Inches As A Decimal

Oct 21, 2014

I have my program all but done, but I can't get past this last part. I need to have the user input their height as a decimal. For example someone who is 5 foot 11 inches would need to enter it as 5.11, then I need to display there height in inches. Since i'm 5 foot 11, I would need to enter 5.11, then have it display 71 inches.

View 4 Replies View Related

C++ :: Program To Convert Meters To Feet

Mar 28, 2013

(Program) a. Write a C++ program to convert meters to feet. The program should request the starting meter value, the number of conversions to be made, and the increment between metric values. The display should have appropriate headings and list the meters and corresponding feet value. If the number of iterations is greater than 10, have your program substitute a default increment of 10. Use the relationship that 1 meter = 3.281 feet.

b. Run the program written in Exercise 6a on a computer. Verify that your program begins at the correct starting meter value and contains the exact number of conversions specified in your input data.

here is what have so far

#include<iostream>
#include <iomanip>
using namespace std;
// a programs to convert meter to feet
int main() {
const int MAXMETER = 10;

[Code] ....

I don't know how to have a setup where you input the values, and then will be provided the output.

View 4 Replies View Related

C++ :: Stretching Image By Dimensions

Dec 16, 2013

Write a function that takes a picture and two integer values ​​and stretching the image by dimensions.

View 8 Replies View Related

C++ :: Vector Assign In Two Dimensions

Oct 29, 2013

If I have a one-dimensional array of length 10, vector<int> x, and I want to assign all the elements to value 5, then I can do the following:

Code:
vector<int> x(10);
x.assign(10, 5);

(I can also do this in x's constructor, but in my scenario I want to repeatedly assign x's elements in a loop, without having to construct a new vector in memory each time.)

If I now have a two-dimensional vector, vector<vector<int> > y, and I want to assign the first vector to length 20, the second vector to length 10, and each element in the second vector to value 5, then I can do the following:

Code:
vector<vector<int> > y(20, vector<int> (10));
for (int i = 0; i < 20; i++) {
y[i].assign(10, 5);
}

But is it possible to do this without the loop? Can I make the two-dimensional assignment in just one line, in the same way that the one-dimensional assignment was made?

Perhaps it would like something like the following, which is not correct but illustrates what I mean:

Code:
y.assign(20, assign(10, 5));

Another way of doing this would be the following:

Code:
y.assign(20, vector<int> (10, 5));

But wouldn't this cause the memory in the second array to be dynamically allocated each time? I don't want to do this - I want to keep the same memory, but just assign the elements to 5.

View 1 Replies View Related

C/C++ :: Creating A Menu That Will Return The Menu After A Selection

Apr 7, 2014

This is what I have so far, it gives me a nice menu to select from and it all works but after I make a selection it closes the program. I tried to return to it but it won't work for me

#include <stdio.h>
int main() {
int choice;
int deposit;
int balance = 500; {
printf(" CHOOSE FROM THE FOLLOWING

[code]....

View 14 Replies View Related

C++ :: Convert Feet And Inches Into Meters And Centimeters

May 9, 2013

I am new to c++, and I have been going through some basic code to get used to the syntax etc. I have encountered a compiling issue with my current code. The purpose of this code is to convert feet and inches into meters and centimeters.

#include <iostream>
#include <cmath>
using namespace std;
int main () {
<<<xcode is saying I have an expected expression on this blank line>>>
double feet1, inch1, inch2, meter1, centimeter1;

cout << "Please enter a length in feet and inches " << endl;
cin >> feet1 >> inch1 >> ;

I have tried rewriting the #include through int main () expressions, I've tried copy/pasting the lines from other pieces of code...

View 5 Replies View Related

C++ :: Convert Centimeters To Yards Feet And Inches

Jul 14, 2013

I have to write a code to convert centimeters to yards feet and inches i have the code wrtten up and keep getting 2 errors saying im missing a ; before << but im not sure why ?

#include <iostream>//For cin and cout
using namespace std;
int main(void) {
doublecentimeters; //INPUT

[Code] ....

View 2 Replies View Related

C++ :: Simulate Random Walk In 2 Dimensions

Jan 6, 2015

I am writing a piece of code that simulates a random walk in 2 dimensions (an object chooses whether to move up, down, left or right randomly). I would like the program to run the simulation for many objects at the same time. The way i have written it means that for every object i add the code becomes about 40 lines longer. Any method that would simplify the code so that i could have many objects but not pages and pages of code.

#include <ctime>
#include <cstdlib>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<fstream>

using namespace std;
double dist(int a, int b);

[Code] .....

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved