C/C++ :: How To Print 19
Jun 13, 2014#include<stdio.h>
#include<conio.h>
void main() {
char p='19';
}
#include<stdio.h>
#include<conio.h>
void main() {
char p='19';
}
I am making a program where the user enters numbers into an array and then a number,x. The array is sorted, then x is inserted into the appropriate place. I wrote my selection sort
Code:
void Sort(int ary[], int size)
{
int temp;
int smallest;
int current;
int move;
}
[code]....
put it wont print the numbers sorted when I use my print function, just the unsorted numbers.
is there a to use printf to print certain number of blank spaces, where the number is derived from the output of a function?
for(m=low; m<=high;m++)
{
printf("t=%2d %'f(m)-1's %3c", m, ' ',*);
}
This is suppose to output
t=-3 *
t=-2 *
t=-1
.
.
.
I have this code that determines the amount of people that can fit on some trains in different train combination scenarios. Here is the code:
#include<stdio.h>
#include<stdlib.h>
int main(void) {
int total_track, max_train_length, num_people, num_trains, tl;
printf("What is the total length of track, in feet?
[Code] ....
I need to now "pick the winner," or the highest value for num_people computed. How would I go about this and why?
I cant print the characters in the end.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
FILE *arquivo1,*arquivo2,*arquivo3;//files i will open//
char texto;//texto= character i will read.
[Code]...
I found it incredible that I could not found any working example of simple printing text while I was looking on google.
Somewhere I read I should include (I am not sure if I remember the name right but code::blocks on Windows did not find the header)
Code: #include <stdiostream.h>
so I am trying
Code: #include <stdio.h> and cout << "test"; (error: cout undeclared)
or
Code: #include <stdio.h> and std::cout << "test"; also I tried print("test");
as noted somewhere on Answers. Did not work (error: undefined reference print).
Last try I even got most of links in French. So I hope you'll give me the correct answer. Edit: I found it. I used puts()
i am using turbo c++ my program is based on maths equations and my final answer is 918 or any 3 digit number only but i don't want 918 to print instead i want only 18 to print. this program gives different output for every different input so i can't just minus 900 from it and get 18. i just want that no matter what 3 digit number is the answer,i just get the 2nd and 3rd digits while printing it and not the first.
the final answer giving equation is:-
f=2914-1996
where f is my answer and its 918
but i want it to print as 18 not 918
If the graph is found to be cyclic how to print out a cycle??
View 1 Replies View RelatedI wants to print matrix such that Consider that original matrix look like following
1 2 3
4 5 6
7 8 9
Now I want to print like following
7 8 9
4 5 6
1 2 3
we can use only two for loops.
I have previous threads asking how to make a list of words that were matched up be printed out into a .css or .txt
Is there anyway to make the words being printed out in CMD after debugging/compiling a script printed out in a .txt/.cpp file instead? CMD only has 300 lines. I need the outcome to be printed out elsewhere so more lines can be posted rather than 300.
Given three integers, print out the ratio max/min
#include <iostream>
using namespace std;
int main(int x,int y,int z,int max,int min)
[Code].....
My Dev++ App in error
I have the following code to print a string to the LCD using my PIC32 Starter Kit; I have made this code work with success. I cannot, however, make the LCD print numbers.
#include<p32xxxx.h>
#define LCD_PRT PORTE //LCD DATA PORT
//#define LCD_DDR DDRE//LCD DDR
//#define LCD_PIN PINE//LCD PIN
[Code].....
I want to change the original code as little as possible, don't worry about my header files - they are fine.
i wrote this piece of code but i am now stuck because i dont know how to print the elements from my class. For example, how can i print the three elements of student s?
#include <iostream>
#include <map>
#include <string>
using namespace std;
[Code].....
I did write a print function which the user put a number and then it will print out till that number
the output is correct ,, but is code correct ? or it could be better somehow ?
write a function named print_out that print all the whole numbers from 1 to n. test the function by placing it in a program that passes a number n to print_out , where this number is entered from the keyboard . the print_out function should have type void; it does not return a value. the function can be called with a simple statement:
print_out(n);
PHP Code:
# include <iostream>
using namespace std;
void print_out (int x);
int main () {
int n;
cout << " enter a number : ";
[Code] ....
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".
So i am struggling for days to get this done and all i need is to get the sum of the areas and get them printed on the screen my code is this:
Code:
#include<stdio.h>
#include <stdlib.h>
#include<conio.h> //Not needed in Dev C++//
#define PI 3.1415
float Area_of_Rectangular(float length,float width);
float Area_of_Circle(float radius);
int main()
[Code]...
I am creating a trie (not a tree but a trie). I have the following structure:
Code:
struct tnode {
bool is_word;
list *children;
};
struct trie {
int length;
struct tnode *first;
};
list *children is a linked list that contain pointers to tnodes. For example: I have a trie with the words cup and cut:
c
u
/
p t
Given the example above you have the following linked lists:
1. [c] that contains a pointer to linked list 2.
2. [u] that contains a pointer to linked list 3.
3. [p, t]
Now I want to print the trie like:
cut
cup
How to print out these structures using loops.. printing out these outputs using loops..
View 5 Replies View RelatedOk, I think I got the main idea of the I/O chapter. Though I think I might be oversimplifying the program because I am getting an interesting error.
Goal here is to read numbers from a file and print the numbers with totals for two of the columns and a calculated average for of the totals.
NOTE: The tables for the info from file look a lot better on my end. [QUOTE] seems to mess it up a bit from copying and pasting.
Info from problem:
Car No. Miles Driven Gallons Used
----------------------------------------------------
54 250 19
62 525 38
71 123 6
85 1,322 86
97 235 14
carinfo.txt file:
54 250 19
62 525 38
71 123 6
85 1322 86
97 235 14
program:
Code: updated code
1. Create a variable named index and nitialize it to zero(0)
2. Prompt for and input a string value from thekeyboard. Store the string inthe string variable newstring[80].
3. While (newstring[index] does not equal ‘ ’).
i. Display the character at newstring[index] followed by a NL
ii. Increment index ====================================== ...
And this is what i have done so far and i dont know where I am wrong ...
Code:
#include<stdio.h>
int main()
{
int index = 0; //initialize index to zero since first elementin an array is numbered zero
char newstring[80];
[Code] ....
How to insert a node and print it out. I am not sure if I am doing this correctly or if I am missing anything. It seems that the head keeps getting overwritten with the most current key and that the nodes are not pointing to each other.
Here is my code so far:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
// Global Declarations
typedef struct {
int key;
[Code]...
I am making a program that takes the user's family names, their ages, and where they live. At the end I will be eventually averaging out their age and also printing the names of anyone who lives in Kansas.
I can't seem to get the Kansas part to work properly though.. When I execute the code, everything else works perfectly, but the Kansas part doesn't even print. Is there something different I need to do when strings are involved rather than integers/floats?
Code:
#include <stdio.h>
int main ()
{
/* variable definition: */
[Code].....
How do i print another shape near the one i did. I have this code but how i can put another shape near it like this
Code:
#include <stdio.h>
int main() {
int i;
for (i = 0; i < 5; i++)
switch (i) {
case 0:
printf(" *
[Code] .....
if you have something like this how can you print the string in main??
Code:
/#include <stdio.h>
#include <stdlib.h>
void myf(char *p)
{
p="balls";
}
int main()
{
[Code]...
This is my code:
int main() {
int num;
printf("Please enter a number: ");
scanf("%d", num);
printf("%d", num);
return 0;
}
when i compile and run it, it stops working and doesn't printf the integer.
I'm having trouble understanding how to get my phonebook to print out it's entries. If I just have one entry, it will correctly display it but if I have 2 or more, it leaves out chunks of that entry's data.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
[Code].....