C# :: How To Display Input Number Of Asterisks
Nov 14, 2014
I have been stuck at a dead end,I got it to display a single asterik for an inputted number, but how would i go about in adding that asterik for each number?
my code is the following
int userinput = int.Parse(InputOutput.GetInput("Enter values into array"));
Int32[] inputChoices = new Int32[9];
for (int x = 0; x < inputChoices.Length; x++) {
inputChoices[x] = 0;
} if (userinput == 1)
[Code]...
View 2 Replies
ADVERTISEMENT
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
Apr 11, 2015
I have a code for random numbers between 0 and 90 but i can't figure out how to change the output for numbers to asterisks. Ex. if the random number is 8 i need it to print 8 asterisks.
#include <stdio.h>
#include <time.h>
#define MINR 0
[Code].....
View 7 Replies
View Related
Apr 5, 2013
If the user puts in a 6. I need the array to display the even number from 0 - 6. Right now what it does is it displays the first six even numbers. Okay as I'm writing this I'm starting to see where my problem might be..
Code:
void sumIntegers () {
int arr[50];
int i = 0;
int num = 0;
int sum = 0;
[Code] .....
View 1 Replies
View Related
Sep 9, 2014
What I'm trying to do is have the user input a hex number this number will then be converted to a char and displayed to the monitor this will continue until an EOF is encountered.I have the opposite of this code done which converts a char to a hex number. The problem I'm running into is how do i get a hex number from the user I used getchar() for the char2hex program. Is there any similar function for hex numbers?
this is the code for the char2hex program
#include <stdio.h>
int main(void) {
char myChar;
int counter = 0;
while(EOF != (myChar = getchar())) {
if (myChar == '')
[Code] .....
This is what i want to the program to do except it would do this continuously
#include<stdio.h>
int main() {
char myChar;
printf("Enter any hex number: ");
scanf("%x",&myChar);
printf("Equivalent Char is: %c",myChar);
system("pause");
return 0;
}
View 1 Replies
View Related
Sep 6, 2014
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.
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
Dec 15, 2014
I have to make a program that displays a square of asterisks based on the users input. Here is what I have so far.
#include<iostream>
using namespace std;
int main(){
int number;
cout << "Enter a number: ";
cin >> number;
for (int i = 0; i < number; i++){
[Code] ....
But the square needs to be hollow like this. So if the user enters 5 then the following square will be shown.
*****
* *
* *
* *
*****
How to make it do this.
View 11 Replies
View Related
Aug 26, 2013
I am having a problem printing out the results for my code, It is supposed to print out the largest and smallest value in the array, but keeps giving me a value not entered and I don't know why.
//This program lets the user enter 10 numbers and then display the highest and lowest number.
#include <iostream>
#include<stdio.h>
using namespace std;
int main() {
const int NUM_ENTERED = 9;
int number[NUM_ENTERED], highestValue = number[0], lowestValue = number[0], count=0;
[Code] .....
View 2 Replies
View Related
Apr 20, 2015
Im trying to figure out how to print a random number of asterisks on two separate lines at the same time. So every time you press a key it prints a different amount of random number of integers between1 and 10 until one of the lines reaches 70. I have the code to do one line but can't figure out how to do two at once.
#include <stdio.h>
#include <time.h>
#define MINR 1
#define MAXR 70
#define MINM 1
#define MAXM 10
int main (void)
[Code]...
View 2 Replies
View Related
Apr 26, 2013
I need to write a code in c++ , to input decimal number and the output to be number in Scientific notation with 32 bits .
View 1 Replies
View Related
May 17, 2014
The code is supposed to display the total and averages of the data as well, but cuts off due to an error in the code.
Since this code is quite lengthy, I will be breaking it up into two posts.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
[Code].....
View 6 Replies
View Related
Nov 14, 2014
Q. WAP to find the next palindrome number larger than the input number.
for eg:-
Input=25
Output=33
The program is giving correct output for number with all digits '9';
why is it not giving output.
#include<iostream>
#include<string>
using namespace std;
int main() {
int len,flag=1,count=0,num,ind;
[code]....
View 8 Replies
View Related
Mar 12, 2014
I am getting strings from an HTTP request that will have hex values and I must convert those strings to a signed decimal.
//typical string inside response: //0E1D052BFBB711C1002C0042007A014DFE44022B270F7FFF8000000000000000
//every 4 characters above are a signed decimal value
for (a = 0; a <= 63; a+=4){
sprintf(vval,"0X%c%c%c%c",response[a],response[a+1],response[a+2],response[a+3]);
ds = strtol(vval, NULL, 16);
sprintf(vval,"%d",ds);
}
The problem is I never see a negative number. Decoding 0x8000 gives me 32768 but not -32768.
View 7 Replies
View Related
Jan 23, 2014
i wrote this program to display even number from 100-200. But visual c gives me this error with undeling the "a" in if statement. Error1error C2106: '=' : left operand must be l-value
#include<iostream>
#include<conio.h>
using namespace std;
void main(){
for(int a=100;a<200;a++){
if(a%2=0)
cout<<a<<endl;
}
_getch();
}
View 1 Replies
View Related
Aug 12, 2013
C program I am making.
For example: if nNum is 12345, the program should display 12,345
View 2 Replies
View Related
Feb 21, 2014
How to print such list of asterisks using a for loops. There are a total of n lines, n is a variable.
View 3 Replies
View Related
May 16, 2014
The code is supposed to display the total and averages of the data as well, but cuts off due to an error in the code. The code should also:
1)Print checks for all employees, one per page, sorted by lastname. The first check number, 100, is to be read from a company data file (see requirement 4). The border of each check is important and should not be omitted.
2)Convert the net pay to a text string for each check printed.
3)Print a reference code on each check. The reference code is obtained by combining the first letter of the lastname with all the consonants remaining after removing all vowels (a,e,i,o,u).
4)Use the same employee data found in assignment 2. Use company data, obtained from a text file, for each check printed:
Spoiler
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef short BOOLEAN;
typedef char STR15[15 + 1];
typedef char STR10[10 + 1];
typedef struct PayRecord
[Code] .....
View 14 Replies
View Related
Feb 5, 2015
I trying to write a program able to read a number up to 3 digits and display it in words. What to do first.
View 1 Replies
View Related
Feb 13, 2013
how can i display the number of variables or character that the user input?
View 4 Replies
View Related
Nov 12, 2013
Write a program that asks the user to enter an integer between 1 and 15. If the number entered is outside that range, your program should print out an error message and re-prompt for another number.
Once the user enters a number in the correct range, your program will print out two patterns of asterisks that look like the following. Note that the number provided by the user is equal to the height of the pattern.
Let us say that the input value was 5. Then please print the following two patterns:
*****
****
***
**
*
[Code].....
View 9 Replies
View Related
Jan 27, 2015
So I have to create a program which will print, among other things, a rectangle made of asterisks. The rectangle has to follow this general format:
*****
* *
*****
but with the width and length of the rectangle being set by the user. I've tried every way I can think of to work this out, but I can't seem to get anything to work. The main errors I'm getting are either an infinite loop of asterisks filling my screen or nothing at all, depending on whether I use an && comparison or ||. A screenshot of my code is included below.
View 5 Replies
View Related
Mar 17, 2013
I am having problems printing "->" on the beginning of each line, im trying to do it as a loop and ending it when the user types "q". also i would like to know how to ignore text from the user when the input begings with a specific character. heres what ive done so far, and not currrently working as expected.
Code:
#include <stdio.h>
int main (void) {
char prompt;
printf("~~~ FRACTION CALCULATOR ~~~
[Code] ....
View 1 Replies
View Related
Mar 13, 2014
How can i write a program that allows a user to enter a size of pizza and then print the price for that size.
Example: if a user enters size ''s'' then it should display the price stored under ''s''
View 3 Replies
View Related
Jan 10, 2015
I'm coding a hangman game. I'm trying to store user entries so i can output them to show the user what they have already entered. Problem is that it's not display anything at all.
I'm trying to store multiple characters of course, and then display all characters stored.
char guess[27]={0};
cin >> guess[26];
int hit=0;
for(int i=0; i<len; i++) {
if( guess[26] == hidden_word[i] ) {
hit++;
select_word[i] = guess[26];
if(strcmp(hidden_word,select_word) == 0) {
[code]....
EDIT: I also get the error - Stack around the variable 'guess' was corrupted. At the end of the game.
View 6 Replies
View Related
Feb 9, 2013
Program that input a name horizontal and display the name in vertical position using looping any kind of looping?
EX.
INPUT:Enter A name:John
OUTPUT:
J
O
H
N
View 3 Replies
View Related
Sep 26, 2012
I'm trying to code a program to read the user's input and have it:
-count vowels
-stop counting vowels after '.' or '?' (ie. abcdjwef is 1 a, 1 e; while fje.fwdfeiii is just 1 e)
-closes when ENTER is pressed after a '.' or '?' is found (ie. closes after 'abacds. ENTER' as well as 'as.fefsdf ENTER')
-display the number of vowels
Is there any way to do this with only 'cin >> userInput' and a while loop checking for punctuation?
View 1 Replies
View Related