C :: Loops That Would Generate Same Results

Nov 20, 2013

Using loops that would generate the same results. I need to use a loop that would make the syntax less lengthy ....

Code:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<iostream>

float check(float s);
void load(float*);

[Code] .....

View 2 Replies


ADVERTISEMENT

C++ :: How To Do Operation Of Two Integers That Gives Results

Feb 25, 2014

How do I do the operation of two integers that gives you the results?

I'm supposed to write a program that:

Asks the user for an integer
Asks the user for one of '+', '-', '*', or '/' (as a character)
Asks the user for another integer
Performs the given operation on the two integers, and prints out the result of

Please enter an integer: 4
Please enter an operation (+, - , *, /): *
Please enter another integer: 5

4 * 5 = 20

Code:
#include <iostream>
using namespace std;
int main() {
int x;
int c;
int d;
char e;

[Code] ....

View 7 Replies View Related

C++ :: How To Pause After Outputting Results

Feb 19, 2013

I mean on the executable file. It just displays the results and quickly flashes away, cin.get() has no effect and system("PAUSE") is undeclared.

I never found a single sure way to pause effectively. Is there a method that works all the time? Sometimes cin.get() gets skipped even in the code itself. The IDE I am using is Code Blocks if that matters any.

View 4 Replies View Related

C++ :: Console App - Outfile Results

Aug 5, 2013

I have created a game that functions correctly, however, for balancing and future changes, I would like to record results .txt document (its 1v1 btw). I already have code to determine who won and what I am looking for is some way to keep track of different match-ups for the different characters. Im looking for something like this:

loser
Winner char1 char2 char3
char1 3 2 5
char2 2 5 4
char3 8 1 2

the numbers are the amounts of wins a given character has over another character. I'm looking for code to open the .txt file and add 1 to the respective win total so I can do balance changes and such.

View 1 Replies View Related

C++ :: Excel XLL Returns Different Results?

Feb 1, 2015

I am using Excel 2013, Visual Studio 2015. I began learning about Excel XLL. I wrote simple function which tests whether the argument is missing. Here's code:

#define DllExport __declspec(dllexport)
static LPWSTR rgFuncs[1][7] = { { L"GetSum", L"BU", L"GetSum" } };
DllExport double WINAPI GetSum(LPXLOPER12 arg)
{
if (arg->xltype == xltypeMissing) return -1;
return arg->xltype;
}

This code works as expected: if I miss argument, it gives me -1, and the type otherwise. But when I change code to this:

DllExport double WINAPI GetSum(LPXLOPER12 arg)
{
return (arg->xltype == xltypeMissing) ? -1 : arg->xltype;
}

then, when I miss argument, it gives me 4294967295. Why?

View 2 Replies View Related

C++ :: Adding Results Of Incremented Value?

May 11, 2013

The point of this program is to calculate how many cents the user would have after a certain number of days. The user is given .01 cent on day one, and this amount is doubled with each passing day. I cannot seem to figure out how to add all of the results. Currently, my program simply outputs them to the screen. How do I tell it to add all of the results and store the sum in one variable?

#include <iostream>
#include <cmath>
#include <iomanip>
int main() {
using namespace std;
float totalF = 0;//total amount earned after number of days specified by user have passed

[code]....

View 9 Replies View Related

C++ :: Can't Total Up The Results Calculated

Apr 8, 2013

i am doing a sales commission program to run a counter on the commission calculated, but the answers can't show on the counter

here's what i've done so far:
#include <iostream>
#include <iomanip>
#include <cmath>

[Code].....

View 2 Replies View Related

C# :: Unable To Get All YouTube Results (API 2.0)

Nov 5, 2014

I'm using below code snippet to fetch Youtube video titles, when you enter a query into a listbox, and press the search button:

int resultsn = 0;
void YTReq(string appname)
{
devkey = "my-dev-key-here";
YouTubeRequestSettings settings = new YouTubeRequestSettings(appname, devkey);
request = new YouTubeRequest(settings);

[code].....

But what i get is exactly 500 results, even if i remove the 500 search limit radio-button (i've put that later, after seeing that the search only fetches 500 results). But when i search the same query on YT, i get 1000s of results. What's the wrong with my code?

[URL] .....

View 9 Replies View Related

C# :: Perform Web Request And Get Results?

Sep 17, 2014

Here is the site that I want to interact Genderchecker

I want to set a value to a specific element in a web site. Perform a click on an element that is image. Get the result <span> text into string variable...

What should I use ?

View 2 Replies View Related

C# :: (NET) Interpreting Profiler Results?

Oct 1, 2014

I am nearing completion of my first real app.. but I noticed a nasty catch in that it consumes 10-20% CPU at idle. I went around commenting features that I suspected may be causing it but it had 0 impact and my CPU usage at idle is still 10-20%.

The program has two threads, one of which is used very little and the second one consume needless CPU.. The only clues a profiler gives me is

MS.Internal.Text.TextInterface.Generics.NativeIUnkownWrapper<MS::Internal::Text::TextInterface::Native::IDWriteFont>...

But the process which takes up all the CPU seems to change every time I start the profiler. Sometimes it is WindowProc or ThreadingProc..

Can how I interpret this and make meaningful changes to how my code runs?

View 3 Replies View Related

C :: Program Produces Different Results On Different Computers

Feb 13, 2013

I was doing problem 10 on project euler Project Euler. The following code produces two different answers on different systems:

Code:
#define INPUT 2000000
Bool isPrime(const int number) {
int i, sqr = sqrt(n);
if(n%2==0) return 0;
for(i=3;i<=sqr; i+=2)

[Code] .....

Computer A:
Linux 3.0.0-30-generic #47-Ubuntu SMP Wed Jan 2 22:39:01 UTC 2013 i686 i686 i386 GNU/Linux
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Ubuntu 11.10

Computer B:
Linux 3.2.0-31-virtual #50-Ubuntu SMP Fri Sep 7 16:36:36 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Ubuntu 12.04

Compiled by: gcc program.c -o run -lm

Computer A generates this answer: 1179908154 (wrong)
Computer B generates this answer: 142913828922 (right)

My guess might be because they are running on different architectures. But I really don't know.

View 3 Replies View Related

C++ :: Save Big Volume Of Computation Results

Feb 27, 2013

I run some computations which give a big number of vectors (let's say 100 vectors, each one contain 2000 elements of type double). I want to save those data and import them into Excel.

I know I can save the results through in txt file. But it would be a very long file. Can I save the results in other more efficient file form that can be imported into Excel? and how?

View 7 Replies View Related

C++ :: How To Use Bool Function To Get Results For Acceleration

Nov 5, 2013

How to get my data from the file and output, but now I am having trouble with my acceleration function. Right now, I have the acceleration function commented out and the output for acceleration at the bottom because if I try to run the program with them in it the program stops working. working with acceleration calculations and then finally outputting that acceleration.

//Program that reads the time and vertical velocity data and then calculates things from it

#include <iostream>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <iomanip>
using namespace std;
bool calculateAccelerationArray (vector<double> t_array, vector<double> v_array, vector<double>

[Code] ....

The file I'm reading from rocketVelocityData.txt gives me the time and velocity.

View 3 Replies View Related

C# :: How To Populate HTML TextBoxes With SQL Results

Mar 9, 2015

I have an HTML5 form with a number of text boxes on it. I would like these textboxes populating with data retreived from an SQL database, using inline C#. I have a stored procedure that returns the data.

View 8 Replies View Related

C/C++ :: How To Print Results On Screen Without Using Printf

Jun 26, 2013

how to print the result on screen without using printf in C...?

View 6 Replies View Related

C/C++ :: Illogical Results By Using Try And Catch Block

Oct 24, 2013

there are illogical results by using try and catch block

#include<iostream>
using namespace std;  
class Circle_computations {  
public:
    double area,circumference,radius,pi;  
public:    
 Circle_computations() {

[Code] ....

View 1 Replies View Related

C++ :: Pass By Value And Results By Variable Program

Jun 7, 2014

The instructions: A nutritionist who works for a fitness club facilitate members by evaluating their diets.As part of her evaluation, she asks members for the number of fat grams and carbohydrate grams that they consume in a day. Then, she calculates the number of calories that results from the fat using the following formula:

Calories from fat = fat grams x 9

Next, she calculates the number of calories that result from the carbohydrates using the following formula:

Calories from Carbs = Carbs grams x 4

Create an application that will make these calculations

-DO NOT use global variables
-Create two variables in main that will hold the two results
-Pass fat and carbs by value, and the result variables by reference
-Output in main

The key with what you need to pass is this: Pass fat and carbs by value, and the result variables by reference. This is what I have to far but I don't understand how to "pass by value, and results by variable" ....

#include <iostream>
using namespace std;
void grams (int);
void calories ();
int main () {
//Get fat and carb grams

[Code] ....

View 2 Replies View Related

C++ :: Keep Getting Wrong Results With Char And Scanf

Nov 12, 2013

Code:
#include <stdio.h>
int main(){
unsigned char x, y=10;
scanf ("%c", &x);

[Code] ....

If I take out scanf and assign x a value then it works, but if I enter, for example, 10 into scanf it comes up as 234 rather than 100.

View 13 Replies View Related

C++ :: Program To Store Results In Two-dimensional Array

Apr 6, 2013

5. Four experiments are performed and each experiment produces four test results. The results are tabulated as shown below. Write a program to store these results in a two-dimensional array, A[4][5], then use a nested for-loop to compute the average of the test results for each experiment and store it in the 5th column of the array. Print the array.

1st experiment results: | 23.2 | 34.8 | 53.7 | 19.5 |
2nd experiment results: | 34.8 | 42.9 | 28.6 | 35.4 |
3rd experiment results: | 24.5 | 29.5 | 32.0 | 19.3 |
4th experiment results: | 36.8 | 31.6 | 43.7 | 29.5 |

6. Using the srand( ) and rand ( ) C++ library functions, fill an array of 1000 numbers with random numbers that have been scaled to the range of 1 to 100 inclusive. Then determine and display the number of random numbers having bvalues between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?

View 2 Replies View Related

C++ :: Create A Converter But Results Must Be In 4 Decimal Places

Dec 1, 2013

I have to create a converter but the results must be in 4 decimal places just like, if i Entered 5000mm the result would be 500.0000cm . what should I do ? I used Float function

View 1 Replies View Related

C++ :: Program That Will Give Multiple Calculation Results

Apr 4, 2013

I need to write a program that will give me multiple calculation results.

#include <iostream>
using namespace std;
int main () {
int x = 8;
int y = 7;

[Code] ....

It only calculates the last two numbers: 1 and 0, so therefor it gives me 1.

But i need to calculate x and y each time they are smaller(incremented) by one digit.

Please note that the int calculation formula needs to stay.

View 2 Replies View Related

C# :: Using Info From MySQL Tables And Referencing Results

May 8, 2014

Basically I have a few tables in my Database.

So I have one table that is like so:

Item_ID, Name, Parent ID.
1 , jeff , 5

and another table like this:

Parent_ID, parent_Name
5,jackson

What I would like to happen, when I run my code is that I'll get the following

Item_ID, Name, parent_Name
1 , jeff , jackson

DataSet DS = new DataSet();
if (this.OpenConnection() == true) {
mySqlDataAdapter = new MySqlDataAdapter("select Item_ID, NAME, Parent_ID from table1, table2", connection);
mySqlDataAdapter.Fill(DS);
dataGridView1.DataSource = DS.Tables[0];
//close connection
this.CloseConnection();
}

So this spit out parent ID = 5.

I've not worked with Dataset before and I was just wondering what is the best approach? Can this be done via a SQL command or will I have to replace the value(5) with the string(jackson) using a large IF loop to search and replace.

View 1 Replies View Related

C/C++ :: Display Final Results Of Grade Calculation

Sep 14, 2014

I had to write a simple program that prompted the user for various test scores and it would pump out his grade average at the end. I did that with no issue, however, my instructor wants me to add something to the end off the code and I'm not sure how to do that. My code is:

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
string tempType;
float SumTest, MaxTest, TestAve,ProgAve,output;
[Code] ....

And this is what I'm supposed to add, the averages are supposed to have numbers from what the user gave.
***************************
Grade Calculator

Program Average
Test Average

Final Grade
***************************

View 6 Replies View Related

C++ :: Different Input Results Using Cin Extractor And Relational Operators?

Sep 18, 2013

I am using VS2K12 version 4.5.50709.

I am working Prata's C++ Primer 6ed. The exercise sequence of Listing 6.9 through Listing 6.11 involved using a switch statement with integer input (switch.cpp: 6.9), character input (switchchar.cpp: 6.10), and using integer input with enum (enum.cpp: 6.11). The main function of each was similar, especially in the usage of the input variable used by cin ("code" in the code provided below).

With switch.cpp, it was shown that entering a character caused the loop to cycle continuously. This was because the "cin >> choice" call failed to read the character into the int (choice) variable. The 'cin.fail() test followed by cin.clear().get() was added to switch.cpp to prevent the bad read from producing the loop spin.

However, in the original version of enum.cpp (below), which also uses integer input, if I input an 'm', the response is:

Enter color code (0-6): m
Bye!Press any key to continue . . .

In other words, with character input the int based read operation apparently did not fail. The main methods were very similar, but I noticed that switch.cpp used the "!=" operator in the while loop's test expression. So I tried it in enum.cpp and it is commented out in the code below. I found that with that code in place the inability to handle character input was present. When a character is input the failing response is:

Enter color code (0-6): Always include default case.
Enter color code (0-6): Always include default case.
Enter color code (0-6): Always include default case.
...
...

I assume this is a VS2K12 quirk, but I will likely try something like gcc at work tomorrow. I think it would be easy to chase this though the iostream code, for someone who has already been there. But it is going on 1AM, and I am not certain it would be time well spent (i.e. how often do you "really" need to debug iostream code?). I did use the debugger and see that (I believe) _OK is set to false.

// enum.cpp -- Listing 6.11 (PG 279): Using enum (091513)
#include <iostream>
// const int red = 0, orange = 1, ....
enum {red, orange, yellow, green, blue, violet, indigo};
int main() {
using namespace std;
int code;

[code].....

View 14 Replies View Related

C :: How To Send Results Of Code To Output File And Then View It

Jan 18, 2015

In this one program (3 body problem), there are 6 inputs that are scanned (mass, velocity and position of the 2 bodies) and these inputs are computed to arrive at values for x, y and time for the third body. There is a working code that for of extremely small time steps, i.e over 5000 iterations, it produces values for x and y positions of the third body.

I believe this info is sent to an output file since there is a:

FILE* output=fopen("results.out", "w");

I want to play around with the code, insert different values for mass and velocity of the two bodies, but I don't know how to view the results? Im guessing I need to create a results.out file somewhere, but how do I go about doing this?

Do I need to assign memory to the results and then forward that to the output file somehow?

Here is the code : 3body.c

I have a compiler and what not, I'm just unsure how i can get these results out is all.

View 1 Replies View Related

C/C++ :: Drivers License Exam (Read Results From File)

Apr 14, 2015

How to get this code to compile and build. It gives me a really strange error saying:

"1>Project 7 Code.obj : error LNK2019: unresolved external symbol "void __cdecl checkAnswers(char * const,char * const,int,int)" (?checkAnswers@@YAXQAD0HH@Z) referenced in function _main
1>C:UsersHaruha Raharu HarukoDesktopSpring 2015 Class WorkIntro to ProgrammingProject 7Project 7DebugProject 7.exe : fatal error LNK1120: 1 unresolved externals"

Here is the specifics on the assignment:

"Complete Programming Challenge #12 (Driver's License Exam) with file modification

The State Department of Motor Vehicles (DMV) has asked you to write a program that grades the written portion of the driver's license exam, which has 20 multiple choice questions.

Here are the correct answers:

1. B 5. C 9. C 13. D 17. C
2. D 6. A 10. D 14. A 18. B
3. A 7. B 11. B 15. D 19. D
4. A 8. A 12. C 16. C 20. A

Create a TestGrader class. The class will have an answers array of 20 characters, which holds the correct test answers. It will also have a student array of 20 characters to hold the student's answers. It will have three public member functions that enable user programs to interact with the class: setKey, setStudent, and grade. The setkey function receives a 20-character string holding the correct answers and copies this information into the answers array. The setStudent function will read in the student's answers from the file student.txt and will store the answers in a 20-character array named student. The grade method will compare each student answer to the correct answer in the key.

An applicant must correctly answer 15 or more of the 20 questions to pass the exam. After grading the exam, the program should display the following items:

-the number of right answers and the number of wrong answers
-a list of the question numbers for all incorrectly answered questions
-a message indicating whether the applicant passed or failed the exam"

View 5 Replies View Related







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