C :: Create Program Which Requires The Input?

Nov 16, 2013

I would like to create a C program which requires the input in this form: number1 operator number2, where number1 and number2 are numbers of type double and operator is one of the characters +,-,*,/.

There is my attempt to write this code:

Code:

#include <stdio.h>
double main() {
char operator;

[Code]....

Now I have to solve these problems: This code above doesn't work and I don't know why.I don't know how to fix the case when some user enters the input in this form:

Code: 1.5896 *5 or
Code: 7 / 5

I mean how the program knows that

Code: 1.5896 *5 is the same as
Code: 1.5896*5

I don't know how to fix the case when the user enters the input in the incorrect form for example

Code: 3

View 4 Replies


ADVERTISEMENT

C++ :: Writing A Program That Requires Exception Handling

Nov 24, 2013

writing a program that requires exception handling. if an error occurs, i what the program to go back to the begging of the loop. i tried using break but that just makes the program crash when it receives a bad input. how do i do this? this is what i have so far (this part of the program any ways)

while (! quit)
{
// Output phone book menu
cout << endl

[Code].....

View 1 Replies View Related

C++ :: Create A Program That Will Prompt The User For Input?

Dec 28, 2014

I need to create a program that will prompt the user for an input, then it will save their input to a file and then it will prompt the user to input "Open" and then the file containing their first input, will open up and show their input.

View 19 Replies View Related

C++ :: Create A Program That Will Let User Input Amount In Form?

Jan 4, 2014

Figure this out using [TURBO C]

Create a program that will let the user input an amount in the form (367). The Program should determine the no. of coins for each dominations : 50,25,10,5,1. (using Turbo C)

View 7 Replies View Related

C++ :: Create Program That Has User Input 5 Digit Number?

Mar 9, 2013

Im trying to create a program that has the user input a 5 digit number. If it's between 10000 & 99999, it will do one thing..(just saying 'yes' for now. Outside those numbers will prompt the user to input again. However, if the user inputs the exact digits 76087, it should display 'term'.

This current code is displaying 'term' whenever the user inputs the 5 digits.

Code:

#include <iostream>
using namespace std;
int main() {
int pin;
cout << "Welcome to Movie Food
Enter your 5-digit pin code: " ;

[code]....

View 14 Replies View Related

C++ :: Create A Program Which Prompts For User Input Of Current And Birth Date

Sep 27, 2014

I have an assignment in which i must create a program which prompts for user input of current and birth date, which will compare said dates and output if its your birthday or not. I've completed a large portion of it, but cannot figure out how to get the user input of month as an integer such a 2 into February.

#include <iostream>
using namespace std;
class DayOfYear {
public:
void input();

[code]....

View 1 Replies View Related

C/C++ :: Create A Program That Prints A Certain Number Of Asterisks Based On User Input

Apr 12, 2015

I need to create a program that prints a certain number of asterisks based on user input. The user inputs 5 and I want my program to output "*****". How would I do this in C? I've tried printf("%#**", myvariable) but this does not work it only prints "*".

View 1 Replies View Related

C :: Create A Program That Asks User To Input Integer Lengths Of Three Sides Of A Triangle

Sep 6, 2013

C programming: I want to creat a program that asks the user to input the integer lengths of three sides of a triangle, and if so whether the triangle is a right-angled, acute or obtuse one. i am having some doubts about the if, else if statements. I never seem to know how and in what order to use them.

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char *argv[]){
int SideA;
int SideB;
int SideC;
}

[code]....

View 14 Replies View Related

C++ :: Create Simple Input Interface On Console - Allow To Input Values To Variables

Apr 6, 2013

I am trying to create a simple interface on console to allow to input some values to some variables. For ex:

int main() {
double a = 1.5;
double b = 2.5;
double c = 3.5;
string x;

[Code] ....

However, I want these three to display at the same time (now they display one by one), and in the console window I can move the cursor between input place of a, b and c with "arrow key" of keyboard.

View 2 Replies View Related

C# :: The Requested Operation Requires Elevation

Jul 28, 2014

This program is meant to present users with a list of rooms they then press the 'Select' button and it starts the relevant program for that room. However when running the program on Windows 8 it is giving an error that 'The requested operation requires elevation.'

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

[code]....

P.s. It runs the programs as local administrator so that the user does not get prompted for UAC permission, as this is something the users find very annoying!

View 8 Replies View Related

C++ ::  subscript Requires Array Or Pointer Type

Sep 15, 2013

I keep getting this error?

Error1error C2109: subscript requires array or pointer type

Code:
#include <iostream>
using namespace std;
void mean(int [],int);
int main() {
const int arraySize = 25;
const int patternSize = 10;

[Code] .....

View 2 Replies View Related

C/C++ :: How To Create A Timer That Allows Input

May 14, 2013

I am trying to create a five second timer that allows a value to be entered in that span of time. However, if a value is not entered within the five seconds, the timer ends and a value will no longer be able to be entered. I am trying to create a math test that has a five second time limit for equations to be answered.

View 4 Replies View Related

C :: Create File From User Input

Jun 27, 2013

I want to create three files whose names are same but extensions are different. I have to take the name from user. I tried following code but it didn't worked ...

Code:

printf("Name of the file:"); scanf("%s",name);
printf("Format of Input file:");
scanf("%s",ext);
f1=fopen(name.ext,"r");
f2=fopen(name.dat,"w");
f3=fopen(name.src,"w");
f4=fopen(name.RMH,"w");

View 1 Replies View Related

C++ :: Use Of Class Template Requires Template Argument List

Nov 6, 2013

Error1error C2955: 'DoubleLinkedListInterface' : use of class template requires template argument listdoublelinkedlist.h10
Error2error C2244: 'DoubleLinkedList<T>::DoubleLinkedList' : unable to match function definition to an existing declaration doublelinkedlist.cpp7

Error3 .cpperror C2244: 'DoubleLinkedList<T>::~DoubleLinkedList' : unable to match function definition to an existing declaration 12

.h

#pragma once
#include "DoubleLinkedListInterface.h"
#include "Node.h"
#include <iostream>

[Code]....

View 4 Replies View Related

C++ :: Create Two Vectors With 10 Elements And Input Random Numbers

Feb 9, 2014

I can't compile this code as I am at work and the computers are security protected, So i''l have to wait until i get home to test this, but I am pretty sure I am wrong. The problem is I have to create two vectors with 10 elements and input random numbers into it, then pick one of the elements of the second vector at random and append it to an element from the first vector at random. This has to be done 10 times and the I am assuming i have to print the 10 results. This is what I have:

#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main() {
vector<int> random (10);

[Code] ....

View 11 Replies View Related

C++ :: Create Dynamically Allocated Array And Input Some Information

Feb 25, 2013

I am having some trouble on understanding how to create a dynamically allocated array and then inputting some information in to it from a text file.

Example text file:
John Doe saving 135246978 300 0

View 1 Replies View Related

Visual C++ :: Create Process And Wait For Input Idle

Feb 13, 2014

I have a problem with creating a process and waiting until the main window of the new process was shown. I thought I can wait for it with

WaitForInputIdle(pi.hp,INFINITE);

But when the function returns, the handle of the main window of the new process is not available. If I include also a ::Sleep(), the new window is available. Sleep is a bad solution. How can I do it?

View 3 Replies View Related

C :: How To Create A Program That Take AVI File

Jan 26, 2015

I want to create a program that would take an AVI file, alter each frame (ex: change contrast, invert colors, etc.) and dump a new AVI. I've wrote a simple program for this experiment that loads up the header information from the video and dumps it. It also dumps a list of the frame data chunks within the 'movi' chunk.

The info I've gathered from coding this:

1. The recommended buffer size for each type of stream (vids, auds, etc.) is the size of the largest frame of corresponding type, plus 1 or two extra bytes.

2. numFrames in main header is the total number of frames for all types of data (video,audio,etc.) The 'length' value within stream header of type 'vids' is the number of video frames. The sizeImage value within BITMAPINFOHEADER is 921600 (==640*480*3) and the specification states that, quoth, "This can be set to 0 for uncompressed RGB bitmaps."

3. This video uses DIVX encoding.

Now my problem is this: How do I get the data within each video frame in a simple BMP like format? Even the uncompressed frames (with chunk id 'nndb') have variable sizes...let alone the compressed ones.

Information about a software that converts AVIs to a format with fixed sized uncompressed frames. Or at least some information about the frame decompression techniques.

Here's a dump made by the program for a 9 sec, 640x480 video I recorded from Pokemon. (Without the frame dump that is, it'd have made the post too long.)

Code:

AviMainHeader
-------------
size = 56
usecPerFrame = 66666
maxBytesPerSec = 7680000
padSize = 0
flags = 0x00000810
numFrames = 162
initialFrames = 0
numStreams = 2

[Code]...

View 4 Replies View Related

C :: Create A Menu With Program

Oct 29, 2014

So, I was trying to code a menu for a personal movie database. But I'm having some problems.So, this is what I did,

Code:
#include<stdio.h>
int main();
{
do
{printf("Menu

[Code]...

But this is not working.Furthermore I would also like add a sub menu.

View 7 Replies View Related

C :: Program To Create 2D Array For Each Row

Feb 14, 2013

What I am trying to do is to have the program create 2D array that for each row, no two numbers are the same and only consists numbers between 1-9. The array lists out every possible combinations. Supposely I do not know the number of possible combinations, I had it keep adding new rows until there are no more possiblities left.

The problem with my code is when I print out the completed array, it gives out really, really large numbers. But when I print the array from inside the first loop, it gives correct values. I do not know exactly what happened.

Code:
#include <stdio.h>
int main(void) {
int double_digit[1][2];

int a = 1;
int b = 1;

[Code] ....

View 5 Replies View Related

C :: How To Create A Program That Not Allow Negative Numbers

Sep 2, 2013

I have a homework assignment due that told me for the "input specification" that "n" is an integer greater then 0. How would I put this in and where?

View 1 Replies View Related

C :: Create A Program Which Consist Of 2 Function?

Apr 10, 2014

i want to create a program which consist of 2 function. one function should find the greatest number and the other one should calculate the average but when i run this program i get segmentation fault

Code:

#include<stdio.h>
int main() {
int k,i,A[k];

[Code]....

View 8 Replies View Related

C++ :: Create A Program With Trigonometric Series

Mar 30, 2014

create a program that trigonometric series ∑(k-3)sin(π/k-3) with k = 4 until 13..

View 1 Replies View Related

C++ :: Create A Program Using Nested Looping?

Nov 5, 2013

You are to create a program using nested looping. Your program is to have a menu asking the user to select which pattern to create and how many rows to use (it should accept 1 to 10 rows and keep the aspect ratio of the pattern). The patterns are 1 - Box, 2 - V, 3 - Inverted V. Note, if I select pattern 1 with 10 rows, the box will have 10 asterisks in the first row.

Okay so i came up with the box but i have been getting stuck at getting the V or inverted V.

View 1 Replies View Related

C++ :: Create Two Box In Program Using Default Constructor

Apr 6, 2014

Im trying to create two box in this program using the default constructor. When i call to try and display the info, it says that x, y, and z are not declared in this scope. i wanted to have the user cin the length, height, and width using the void setBox function.

#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
class Box{
public:

[code]....

View 2 Replies View Related

C++ :: Create Program That Will Accept 2 Integers?

Sep 4, 2013

how can I create a program that will accept 2 two integers. the user will also choose among the different operations:

1 for addition
2 for subtraction
3 for multiplication
4 for division

View 4 Replies View Related







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