The assignment is to plot the functions, by implementing a function having the following prototype:
void plotPoint(double y);
This function should print a single "*" symbol, in a position determined by the value of y, and then a newline. The position of the * symbol can span over 80 columns: each column should represent a delta of length 0.1 in the value of y, and the zero should be placed on the 40-th column.
For example: • placePoint(0) should print the * symbol on the 40th column • placePoint(0.1) should print the * symbol on the 41st column • placePoint(1) should print the * symbol on the 50th column • placePoint(-1) should print the * symbol on the 30th column
Here is what I have so far:
#include <iostream> #include <cmath> int a; int b; int x; int y; int Func1(double a, double b )/>
[Code] ....
I'm lost now as to where to go to plot. I know that depending on the option chosen I call the corresponding function to return a value for y which is just then plugged into a function to plot it on columns of y.
I have been tasked with making a diamond out of asterisks based on a given odd integer input. For some reason the bottom half of my diamond will not print. I'm not sure as to why.
From my understand the cast (reg8 *) applies to the result of the bitwise OR. But what is the left most asterisk doing?Is it just dereferencing the casted pointer?
i have to make a programs that prompts the user to enter quiz grades and add them up. For examples the user enters 6 test grades they are out of 5 so he enters 0-5 and i store them in the array. This part works great but now i have to print out a bar of vertical asterisks for every part too. So if at the end we have one test grades that are 2 grades of 1 points, 1 grade of two point, 2 grades of three point and 1 grade of 5 point it will have to display them as this
There are 2 grades of 1 There are 1 grades of 2 There are 2 grades of 3 There are 1 grades of 5
i need to do for loops but i am stuck on what to count too and what to print i know i will need cout << "*" and a couple of spaces.
#include <iostream> using namespace std; int main (){ int size; int tests; int a[6]={0};
cout << "How many quiz scores will you enter: "; cin >> size;
i have my basic C program here (i'm new to C language):
Code:
#include <stdio.h> int main() { int grade; int A=0; int B=0; int C=0; int D=0; int E=0;
[Code]....
As you can see, it's only for counting how many students got the grades from A to E, but the problem is that i need to change it from numbers into asterisk
for example: 4 students got the grade A, and 3 students got the grade B
So, I'm going to write a recursive function for a asterisk pattern but I'm stuck figuring out how to create a stopping case for it, better yet, I'm unable to describe the pattern completely.
* Every odd row has 1 * with 1 incremented white space
* Every "pair" of asterisks equals 8 total (EX. 8 one pair *'s, 4 two pair *'s, 2 four pair *'s)
Unfortunately, that's all I got. how I can represent this as I function. Once I figure out what my stopping case should be, I think I can do the coding on my own.
This program needs to display a vertical graph of asterisks showing production for each plant in the company ...
Here is what I have so far:
*********************************** This program will read data and display a vertical graph showing productivity for each plant. Reference Display 7.8 pg. 401-3 *********************************** */ #include <iostream>
Something I am noticing is that temp right after the assignment to *bar, is not the same value as *bar. This is for a project at work and the code runs on an embedded board with an ARM processor. I've copied the function into a standalone program for both Visual Studio and Code::Blocks and it works correctly there.
I'm writing a program that shows check fees for different amounts of checks. My other fees are showing up right but the .10 cents is not. It's showing up as .08 cents per check when I run the program.
Oh yeah the + 10 is for a $10 fee
Code: else if (checks < 20 || checks >= 0) { fee = .10 * checks + 10; cout<< "Bank service charge for the month is $ " << setprecision(4) << endl; }
For an assignment I have to create a random array of four integers, and then I have to allow someone to input up to ten guesses to guess the array in the correct order. I also need to be able to display whatever was generated by inputting -1. Finally, after every guess I have to tell the inputter how many of the guessed integers are correct and in the correct position, as well as how many integers are correct but not in the correct position.
So far I've been able to get the random array to generate properly, but inputting negative one has no effect, although if I input it four times in a row I get to my 'lose' condition. Also, it only seems to allow the user to input 4 guesses and not 10 before going straight to the 'lose' condition. I need to get these issues sorted out before I can move on to showing how many guesses are right etc....
Code: { 0xC6, 0x61, 0x8D, 0x63, 0x0B, 0x39, 0x31, 0xB0 } am I doing something wrong?
I've even tried reversing the byte order of the test data, and I don't get the right result. I've tested the same data using C++ with CryptoPP on Linux, and I get the expected result, but I'm porting this code to run on .Net, and this is my main stoppage in the process at the moment.
My whole code is working but when the results are sent to my phone only the temperature value is reading correct the light value is all jungled up and moisture and pressure values are reading as 0.
I am only receiving the correct temperature value. The other 3 values are reading wrong. My format string isent matching the variable list. What I need to do.
I recently wanted to create a (yet) simple program that simulates a mouse movement.So far I managed to make the program work. It does move the mouse, click when expected but the problem is the location it does click at.Here's my code:
#include <Windows.h> #include <stdio.h> int leftclick (DWORD x, DWORD y); int main(){
[code]......
The problem now is: I want the program (for testing purposes) to click at (1920, 1080) and (100, 100) afterwards. Now it does click within a specific range. When I use GetCursorPos to retreive the cursors position it differs quite a bit from where I expected the click to be.
a second question I have is: When I declare the following flag (in the code above) the program does use relative coordinates even though it shouldn't.
i'm making a for loop for a mini game which required the user to enter the input number.Let say if the user accidently entered a character instead of integer the whole program will go haywire so is there anyway to check for the error and prompt the user to input the data again?Here is the simple program...
I have been experimenting with a program that loads WAV file and tries to read 1s and 0s from audio file (binary coded information). So far I got working code, but the problem is that I'm not getting correct data. I do get somewhat similar data. The problem is that I get data that amplifies low amplitudes, so instead some noise and binary data I get lots of noise and hard to recognize binary data. My code is this
#include <stdio.h> #include <iostream> #include <math.h> using namespace std; // An unsigned char can store 1 Bytes (8bits) of data (0-255)
You can see it's not the same. I do get the same data like I do from binary viewer, but I don't understand how they are translated to amplitude value. ? Where is the catch?
So this is not really question about c++, but about wav file structure and reading data.
I have this function that is supposed to take a float as a parameter and then call the getLine() method to accept the users input. The function basically just checks to see if what the user input was of the same data type, if it is it returns the input value, if not then it keeps looping through taking new input until its correct. The problem is no matter what number you put in the output always returns as 140734799803512.
float InputValidation(){ float num; string strInput; while (true){ getline(cin, strInput);