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
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.
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>
I am creating and implementing a left and a right rotation to balance a bst into an avl tree. I have made and tried 5 different codes that are commented in the functions left_rotate() and right_rotate() but none have run correctly. Sometimes the program works, sometimes there is a segmentation fault and sometimes not all inserted numbers are shown.
avl.c
Code: #include<stdio.h>#include<stdlib.h> #include<time.h> #include "avl.h" #define N 10 void swap(int *a, int *b){
I have a board where a character is. I need to ask the user whether they want to move it up, down, left right. They are allowed to enter 3 move per turn. like up, up, left. How do I do this?
#include <iostream> #include <cstdlib> #include <ctime> using namespace std;
Having trouble getting my square to move to the left my code and instructions of what i am suppose to do is below. No sure how to move my square or if I am even going in the right direction as to writing code to do so. Note that it is only part of my code ( part 2 of project)
Part 2:
Write a graphical application that draws a square and then moves it.
Get the x and y coordinates for the top left corner of the square from the user using the get_int() member function of cwin. Get the length of a side of the square from the user using get_int() as well. Now draw the square to cwin according to the user input.Ask the user how many units to the left they want to move it using get_int() again. Then move the square, clear the screen, and draw it again.
// Part 2 // /* command output to declare the x,y value and 1 side length of a square through user interaction( Has user input intergers) */ int x_value = cwin.get_int("What is the x_value of the top left of the square?"); int y_value = cwin.get_int("What is the y_value of the top left of the square?"); int side_length = cwin.get_int("Input the length for one side of the square:"); /* Data type for the 4 corners of the square */ Point e; Point f;
This works, if just loops through till it doesn't find a space or tab than counts the index at that point then uses substr to get rid of any spaces/tabs, it's a small function and uses a goto. how to do it?
Code: string trimLeft(string lineOfCodeToTrim){ string l = lineOfCodeToTrim; int k =0; for(UINT i = 0;i<l.length();i++){
I am having problems compiling this program. line 29 causes the error "left operand must be l-value".
// chap5proj.cpp : Defines the entry point for the console application. // # include <stdafx.h> # include <iostream> using namespace std; int main() { double mph, time, disPerHour, milesTrav;
I am getting this error when compiling my program with quincy:
Error: I value required as left operand of assignment
The program is meant to calculate how much parking costs based on the amount of hours in a park and what type of vehicle it is. the error is coming from my function definitions which i have just started to add in.
Code: float calcCarCost (char vehicletype, int time, float car) { if ((time > MINTIME) && (time <= 3)) calcCarCost =( CAR * time ); }
The error is on line 72 which is: calcCarCost =( Car * time);
I should probably point out CAR is already defined as a constant with a numerical value given and time is previously asked to be input in when the program runs.
Say I have a function pointer with this definition:
void ( *pressFunc ) ( void*, void* );
And i did this function:
void functionWithOneArg ( void* testPtr );
And i did this
pressFunc = &functionWithOneArg;
One. Would C actually let me do this? ( Assigning a function with one argument to a function with two )
Two. If so, what would happen to the second argument that is passed the function when its called? Does it just get 'cut off' and only the first argument is passed?
How do you add a value to the beginning of a string instead of the end?
This is for an assignment and I have to convert the user input (always assuming its a valid decimal number) to binary and store it in a string. I've got up to dividing by two to get the remainder ...