C :: What Is Left Most Asterisk Doing
Apr 1, 2014
I encounter this from a library:
( *(reg8 *)(pinPC) |= CY_PINS_PC_DATAOUT)
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?
View 1 Replies
ADVERTISEMENT
Feb 12, 2014
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;
[code]....
View 1 Replies
View Related
Oct 10, 2014
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
instead of displaying
A=4
B=3
i want it to display
A=****
B=***
View 11 Replies
View Related
Mar 6, 2015
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
[Code] ....
View 6 Replies
View Related
Jul 11, 2013
Getting close but I think I am stuck on the second loop. The input you put in will be doubled (and it's not supposed to).
Code:
int main() {
int n, i, j, k;
printf("What would you like the height to be? (Positive odd integer)
");
scanf("%d", &n);
[Code] .....
View 3 Replies
View Related
Oct 19, 2014
I have to place two asterisk triangles on top of each other BUT only using 3 for statements. I have gotten the first one:
for(int a=1;a<=10;a++) {
for(int b=1;b<=a;b++)
cout << "*";
cout << endl;
}
I need the output to look like this:
*
**
***
****
*****
******
*******
********
*********
**********
*
**
***
****
*****
******
*******
********
*********
**********
The only kicker is I can have a total of 3 nested for loop statements.
View 7 Replies
View Related
Sep 6, 2014
I feel as if I'm so close and I'm just messing up a value somewhere, but I am at a loss as to what I should change. Here is my code:
#include "stdafx.h"
#include <iomanip>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[]) {
[Code] ....
View 2 Replies
View Related
Sep 2, 2014
void Log_In() {
system("cls");
gotoxy(30, 30);
time_t now;
time(&now);
[Code] .....
How to produce a password field with asterisk ****** .....
View 1 Replies
View Related
Jun 18, 2014
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.
View 6 Replies
View Related
Dec 1, 2014
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.
*
**
-*
****
--*
--**
---*
********
-----*
-----**
------*
-----****
-------*
-------**
--------*
( - represent white spaces )
What I've been thinking:
* 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.
View 1 Replies
View Related
May 19, 2013
When i try to compile this code it gives me a error during run-time saying "*program name* has stopped working"
Code:
#include <iostream>
#include <memory>
using std::cout;
using std::endl;
using std::unique_ptr;
[Code] .....
Why is this happening? Also why do you need the asterisk on smart pointers to assign them a value? Is it just because, or is there a reason.
View 5 Replies
View Related
Jun 25, 2013
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>
[Code].....
View 1 Replies
View Related
Sep 14, 2014
#include<stdio.h>
#include<conio.h>
#include<string.h>
char str1[20], str2[20]="kent";
main() {
printf("Enter your Username: ");
scanf("%s",str1);
[Code] ...
View 1 Replies
View Related
Feb 7, 2013
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){
[Code] ....
View 1 Replies
View Related
Apr 28, 2013
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;
const int COL = 17;
const int ROW = 17;
[Code] .....
View 3 Replies
View Related
Apr 20, 2013
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;
[Code]...
View 2 Replies
View Related
Jul 23, 2014
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++){
[Code] ....
View 2 Replies
View Related
Oct 15, 2014
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;
[code]....
View 2 Replies
View Related
Mar 20, 2012
i want to write a program that input a text from user and align it to the left. Is there any command that i can use? How should i think?
View 12 Replies
View Related
May 23, 2013
I have the following code for a treap but I don't know how to make roate_left and rotate_right functions to balance it.
Code:
#include<iostream>
#include<utility>
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
using namespace std;
template<typename T> class Treap{
[Code] ....
View 1 Replies
View Related
Jun 28, 2013
I have code that prints.
PrintDlg.
StartDoc
StartPage
TextOut
EndPage
EndDoc
I am trying to calculate left margin from (inchis * 100) to pixels. So the left input for TextOut will be correct. How do I do this?
View 8 Replies
View Related
Jun 16, 2013
After I cleared the first vector and copy the second in it there still some characters left behind after copying. How is that possible?
Code:
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main()
[Code]...
View 3 Replies
View Related
Apr 21, 2013
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.
View 10 Replies
View Related
Apr 13, 2014
I'm using Visual C++ 2010 and SFML game library. I want to know how to move an object from right to left automatically and back left to right??
View 2 Replies
View Related
May 5, 2014
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?
View 2 Replies
View Related
May 19, 2013
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 ...
View 19 Replies
View Related