Create a program that will ask the users name, age, and reddit username. have it tell them the information back, in the format: your name is (blank), you are (blank) years old, and your username is (blank).
My program outputted H 0 and an upside down question mark. I was thinking that maybe the error in the program was that i was supposed to use %s instead of %c but im not entirely too sure.
I'm working my way through some C exercises to get some practice and have hit a wall. I need to use a function to take a number, such as 1, and print out One.Here's what I've got so far:
Code: #include <stdio.h> int name(int n); char numberOne[] = "One"; int main(void) { int n; }
[code]...
However, when I run the code and enter "1" the only thing that gets printed to the screen is "(lldb)". I've tried changing it to doing it without variables and just printing "One" but that gave the exact same result.
I am making program that allows the user to determine how big the array size will be and then asks the user to make up numbers to fill the array. Every time run the program on Dev C++ it says "program has stopped working"
Heres My Code:
//Assignment 19 Program 2 #include <iostream> using namespace std; int main()
I was trying to get the name of the user and print it but the only thing that i get is the first Character. For example, in this code, i try to get the name of the user and print it.
I have a problem with how to print out all the numbers that the user enters the code looks like this so far:
Code: #include <iostream> using namespace std; int main()
[Code] ....
I want the program to print out all the numbers that the user has entered after the program have said the higest and lowest number is ?. But I do not know how to do this I thought it could be something like this:
Code: cout << input[0]; //or cout << input[i]; /*
Because i is the number of how many enters of numbers the user can do*/ But that was totally wrong tried to do another "for loop" in the first for loop but that was meaningless because it can't change anything in the first "for loop".
It outputs whole lot of nonsense snippet: 8?/usr/lib/libSystem.B.dylib&X)`!jH??H???H?H?u?????? H?H???H?H?9u?H??<????????UH??H??H?}?H?H???wH??]??? UH??H?? ?}?H?u??E???H??H???l?H??E???????H??H????????? ????M?M??u?H?gH????E??E?E?E?H?? ]ÐUH??????lj??
Basically i want to input a number for example 123456 and get back how many 7's are in the input number and also to print out that same number with stars in between like this *1*2*3*4*5*6*. Here is what i have so far:
#include <iostream> using namespace std; int countSeven(int x){ if(x == 7)return 1; int c = 0; while(x/10 > 9)c++; return countSeven(x/10)+1;
when i compile it does not do what i tell it it just tells me there are 0 7's in the input number no matter how many there really are...
Write a full C++ program that inputs three-digit integer, separates the integer into its individual digits and prints the digits separated from one another. For example, if the user types 549, the program should print;
How to print a year like DIGITAL CLOCK NUMBER for any input four digit number ...
For example if input 1000 the output should be 1000 but each number should look like this in the block form for example number 0 is, don't mind those stars, i did not know to print it here, that is number zero ...
Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging.
See [URL] ....
I'm trying to do this exercise from K&R on my own (with my own code), but I'm receiving a signal (Illegal instruction (Core dumped)) when the input is too large.
#include <stdio.h> #define MAXWORDLENGTH 10 int main(void) { int c; /* Character read */ long length[MAXWORDLENGTH + 1]; int reading_word = 0; int word_size = 0;
[Code] ....
Where the problem might be occurring. I tried debugging with GDB but found no useful information.
Program received signal SIGILL, Illegal instruction. 0x00007ffff7a3b76e in __libc_start_main (main=0x4005d4 <main>, argc=1, ubp_av=0x7fffffffe2a9, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe298) at libc-start.c:258 258libc-start.c: No such file or directory.
The program output is also wrong when tested with the code provided at the link given above.
I am trying to Write a program that inputs three integers from the keyboard and prints the sum, average, product, smallest and largest of these numbers. How do i go about it. What i dont know is how to come up with smallest and largest number .
A Bookseller makes special discount for multiple orders of a book as follows:
AMOUNT and DISCOUNT as follows.
5-9 5% 10-14 10% 15-19 15% 20+ 20%
Write a C main function to read the amount of order from the standard input and compute and print the total price of the given order after the discount. Assume that unit price of a book is 10.00$
My problem is that.When i start with this
Code: #include<stdio.h> #include <stdlib.h> int main(void) { int number; float TotalPrice; printf("enter a number:");
[Code] ....
I get 0 if i enter a number between 0 and 4(0 and 4 included). I don't know where I am doing a mistake. I also want to know if i can handle this buy just if statements. or how can i do it by while and for loops ?
In this simple end-of-chapter problem, the ages of two people are to be compared and determine who's older. The problem I'm experiencing is that the second user name input is being skipped and going straight to the second users age.
So while running the program it looks something like:
What is user ones name? <input name> How old are they? <input age> What is user twos name? How old are they? <input age> <if statement result>
Here's my code:
Code: #include <iostream> #include <string> using namespace std; int user_one_age; int user_two_age; string user_one_name; string user_two_name;
So I've got this form that a user puts in a numeric value into a text box. This value then has to be placed into a byte string of data so that it can be transmitted over as a packet. Bellow is what I have so far:
Code: Byte[] OUTBuffer = new byte[65];//Allocate output memory buffer Byte[] INBuffer = new byte[65]; //Allocate input memory buffer
if (setmSpeed == true) { OUTBuffer[0] = 0; //Not used, must be set to 0 OUTBuffer[1] = 0x85; //Command mode
[Code] ....
I've put in red the area where I'm having issues. I've tried different methods and have not been able to get this working yet. It only works if I speciffy the value manually as with OUTBuffer[1] = 0x85;, but I want byte 2 of OUTBuffer[] to be set with what I put in the text box.
I'm creating a program that should create a structure of a list of people entered by the user; the only problem I'm having is with the %c. When I have it, the loop only occurs once; if I put a %s, the loop occurs up to 25 times, but it doesn't write to the text file. Here is the code:
So im working with forks and creating 2 fork processes. One child and parent. What im trying to get the child to ask me for a value. Then the parent would start to figure out the value and keep trying. Once it figures it out its tells them you got it and simply stops the program. I cant seem to get the program to keep guessing and stop when the number is found which sends a sigint. Here's what i have so far.
I have this code here that counts the number of alphabetic letters the user's input,the number of characters total, the number of words and the number of "the" that was used. However now I need to alter the user's input to have two spaces after the end of each period, no spaces between a word or comma and each sentence has to have a capitalized letter and display them at the end. And I'm stuck on the altering part. I briefly started the 2 spaces after each period but it won't display anything.
#include <cstring> #include <iostream> using namespace std; int main ()
I have written a program and i had to pass an array into a function and now i have a variable for the subscript of the array and i was the user to input data, specificlly a string, more specifically first and last name without having to create two arrays, i have to do this with other things in the program as well, here is part of the program:
int addFunc(const int totNum, string city[],string state[],string street[],string name[], int addNum[],int zip[],int telNum[],double bal[],int dateLp[], int addCount, int accNum, int usNum)//function will add a new account { int countAf = 1; if (usNum < 20)
[Code] ....
it should be able to take firstname space lastname
I need to make a program that takes in a user’s number and keep dividing it by 2 until it is 1.I need to display the division steps ...
I do not know how to keep making it divide by 2 until 1. I tired this but it obviously did not work..
Code: #include <iostream> using namespace std; int main() { //User Input int input,total; cout <<"Enter A Number To Be Divided By 2 Until 1" << endl << endl;
since around 2hours im really fighting with the cin command.It doesn't matter what exactly im trying, it's just not waiting for user input and keeps directly using 0 as "entered" value.
int Value; cout << "Enter a new value: " << endl; cin >> Value; cout << "The value has been set to: " << Value;
I'm trying to make a simple program that accepts user input, simple stuff. When the user (me) enters a number to be sent to the console and i press enter so it accepts the data, it closes the command prompt and thus ending the program. I just need to find a key that i can use to continue but doesn't close cmd.
My parameters are that the users input has to be from 1 to 9 and the same number can't be entered twice. How do i modify this code to make sure that the user did those things or an error message should appear that their input is invalid.
#include <iostream> using namespace std; int main() { int square[3][3];