C :: How To Make 918 Print As 18

Aug 27, 2014

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

View 1 Replies


ADVERTISEMENT

C/C++ :: Make Circular List And Print It

Apr 28, 2015

I have this program. I am trying to do this Circular List but i think something going wrong. The first of all is the list.The second is if my code for delete and select function are correct and the third i would like my program getting a "n" number of names and then make the circural list then print it and then when i select a number delete every node until give us the only one left.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 10
#define NUM_PER_LINE 6
typedef struct node {
char name[SIZE];
struct node * next;

[Code] .....

View 1 Replies View Related

C/C++ :: Make Program To Print Out String

Nov 24, 2014

I'm trying to make a program in C where the user enters a string and it prints a word for example (name) in lowercase then the same word again but in capitals and lowercase like this (NnAaMmEe).

my code is below;

#include<stdio.h>
#include<ctype.h>
int main()

[Code].....

View 1 Replies View Related

C++ :: Make Output Print Out To Screen In Reverse?

May 26, 2013

How can I make the output print out to the screen in reverse?

Code: #include <iostream>
#include <iomanip>
using namespace std;
int getnum();
void Fibonacci(int n);

[Code].....

View 7 Replies View Related

C++ :: How To Make A Program That Print Out Factors Of Integer

Oct 26, 2013

I want to make a simple program that will print out the factors of an integer. My program right now only outputs "The prime factors of 221 are 221, 221, 221, 221"... Where it should be "The prime factors of 221 are 1, 13, 17, 221"

#include <cstdio>
int factorsOf(int x);
//function
int main() {
int x = 221;
printf("The factors of 221 are ");

[Code]...

View 3 Replies View Related

C++ :: Read Data From File Then Make It Into Array Of Structures And Print Afterwards

May 13, 2012

I am trying to read from a data file that has input as :

12.0, 11, 123
14.0, 12.1, 3

And I want the program to read the data from the file and then make it into an array of structures and then print that array afterwards.

Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX_INPUT 1000
int n =0;
int i = 0;
typedef struct {
double x[MAX_INPUT];

[Code] .....

The program when run gives the following output:

Ishtiaque-Mohammed-Khans-MacBook-Pro:Comp20005 IshtiaqueMKhan$ gcc -Wall -ansi -o ProjectB ProjectB.c
ProjectB.c: In function "main":
ProjectB.c:59: error: incompatible type for argument 1 of "print_array"

View 1 Replies View Related

C :: Won't Print Numbers Sorted When Use Print Function

Nov 17, 2013

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.

View 1 Replies View Related

C/C++ :: Using Print Statement To Print Certain Number Of Spaces

Sep 1, 2014

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
.
.
.

View 2 Replies View Related

C :: How To Make Sum Columns

Oct 17, 2013

I have this code it sums the rows now I need it so it would sum all the columns in the output and put it in row 8 of the outcome. How would I go about doing that?

Code:

#include Code: "stdio.h"
#include "stdafx.h"
int main(void) {
int number[8][7];
}

[code]....

View 1 Replies View Related

C++ :: How To Make A Window Always On Top

May 11, 2013

I want to make a window tgat stays always on top like that of a cybercafe software. A window that cannot be closed, minimised, deactivated, etc... with wxWidgets.

So far I've tried making a frame window with the wxSTAY_ON_TOP flag. It works, but not to perfection because, when i press the windows button, the start menu interferes with the window(and taskbar too). Also, the task manager, how to deactivate it.

- a wjndow that strictly stays on top

- deactivate task manager

View 3 Replies View Related

C/C++ :: Make A Window?

Oct 15, 2014

how to make a window in C++? I am trying to make a program that has a boot screen but I want it to be in its own window because it will have it's own pictures in it and text inside too. So not in a terminal but inside a external window.

View 1 Replies View Related

C++ :: How To Make A Simple Program EXE

Feb 12, 2014

I would like to know how can I make a simple program .exe so that I don't have to open it through code blocks every time.

View 2 Replies View Related

C++ :: How To Make Dll And Lib Using G++ Command Prompt

Mar 6, 2015

1. What is dll and lib?

2. How do I make dll and lib using g++ command prompt?

Also, how do I link libraries using g++?

Any good websites that covers my questions,

View 1 Replies View Related

C++ :: How To Make A Template That Has 2 Stacks

Jan 11, 2015

How do I make a Template that has 2 stacks ?

Code:

template <class T>
class A {
};
template <class T>
class B {
};

is this code correct ?

View 1 Replies View Related

C :: How To Make A Char Counter

Apr 14, 2013

One that fills different char arrays the idea is to use a single char to represent a char such as 255 but if more than it then use a char array of two chars to represent the next char 00 because if only one is needed it would take less disk space than 0,255 as it would in an array.

My goal is to do this all the way up to an array that can hold 255,255,255,255 but only use the more complex array if needed Example: a char of 255 takes much less space than a char array of 4 chars so that instead of 0,0,0,255 it is written to disk as a single char whereas a char array of 200,0,0,1 would be written as a 4 byte char array. use single char to represent values from 0 to 255 use two char array to represent 0,1 to 255,255 three for 0,0,1 to 255,255,255 and four for 0,0,0,1 to 255,255,255,255

View 3 Replies View Related

C :: How To Make Exam Schedule

Mar 5, 2013

i want to make a exam schedule with C or C++ language,but I do not know how to do it,which algorithm do i use?

View 6 Replies View Related

C :: How To Make A Sort Function

Feb 28, 2013

Im suppose to make a "poor mans" variation to the Sort function built into unix. The program is suppose to read in a file and sort the contents of the file. So its a variation of the Unix Sort feature. I have remade the readLine function we were provided so that it doesnt use fgets. where to go from here, Not sure on how to make a sort function. Here are the reqirements of the program:

Code:

• Re-implement the readLine() function so that it no longer makes use of fgets(). Instead,
process the input on a given line character-by-character.

• Provide code which will create a data structure similar to argv to hold all of the words to be sorted. Use malloc() to ensure that each entry has just the required number of bytes needed to store the words. The final entry in your array should be the NULL pointer.

• Implement a sort() function which will rearrange the words in sorted order. To swap two words in your array, note that only a pair of pointers need to move. The strings themselves, once established, will never move. Heres what i have:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINES 1000 /* maximum number of reminders */
#define WORD_LENGTH 10 /* max length of reminder message */

[code]....

View 9 Replies View Related

C :: Trying To Make A Stack Through Malloc

Oct 27, 2013

I am curious as to what is happening to my pointers and everything once I call malloc to create space for 5 integers to try to make a stack.

Code:

#include <stdio.h>
#include <stdlib.h>
void add(int * TOP, int * stack);
int main() {
int *stack = NULL;
int *TOP = NULL;
stack = (int *)malloc (5 * sizeof(int));

[Code] ....

I am guessing that when I initialize stack to malloc, stack now stores the starting address of where the space is taken out, and also assigns TOP that address too. I get the choice from the user (b) to get the instruction to try to push on the stack. I was told that the if statement in the function checks if the stack has passed the bounds of 5 elements. If not, it assigns the scanned variable and puts it into what TOP is pointing to and increments TOP to the next address. It is not working and am wanting to see where my logic is wrong.

View 4 Replies View Related

C :: Make A Separate Function

May 6, 2013

I will post the entire code at the bottom. Its running fine right now but This part in the menu function I need to make as a separate function. My problem is when I make it into a function by itself I have to declare and initialize the grades A,B,C,D,F how can I do that when I can't make them equal 0 because it has to keep track of how many of each letter grade.

Code:

//Count letter grade
if(ave >= 90)
++A;
else if (ave >= 80)
++B;
else if (ave >= 70)
++C;
else if (ave >= 60)
++D;
}

[code]....

View 3 Replies View Related

C :: How To Make Nested Loops

Dec 7, 2013

Howi can made nested loops?

Code:

for (yax=0; yax<10; yax=yax+1) {
for (xax=0; xax<100; xax=xax+1) {
printf("%d
",yax);
}
}

way what i tired dont work. or maybe works but why this prints only zeros ?

View 8 Replies View Related

C :: Make A Program Using While Or For Loop?

Nov 20, 2014

I'm trying to write a program for a lab, I know how easy it is but cant see to crack it.

I need to make a program using while or for loop.

I must have the user type a number, for an input value an output value but then do it again several times but without it going on forever asking again and again.

View 4 Replies View Related

C++ :: How To Make Game Available To Be Played On LAN

Jul 1, 2014

I'm making a simple single-player game. Now, assume I've made the game, how would I go about making it available to play on LAN? (I'm not really bothered about making it playable across the world with people not on the same wi-fi)

So, any way that I could get started or any libraries/APIs ....

I'm using Windows 8.1 and I'd like my game to be playable on other Windows OSs (7 and Vista if possible)

View 3 Replies View Related

C++ :: Make EXE File Using CPP Program

May 27, 2013

i need to write a program that when run makes another exe file . Eg: make a program named 'sxes' and compiled it. When i execute or run sxes a new exe file named 'new01.exe' is created. This new01.exe when executed must input two numbers and add them and print output. I want to write a program same as installer file .

View 11 Replies View Related

C++ :: How To Make Shorter Name Output

Feb 17, 2014

#include <windows.h>
void gotoxy(int x,int y);
int main(int argc, char *argv[]) {
char urname[15],surname[15],fullname[30],nput;
int cntr;

[Code] ....

example
Please Enter your name : Ron
Please Enter your Surname : Smash
Your name is : r.Smash

// just an example that i input my name Ron and a surname Smash

My question is how to make the output in Your name is : is only r.Smash

View 4 Replies View Related

C++ :: Can't Seem To Make STL Iterator Class

May 24, 2013

I can't seem to make the STL iterator class work how I need it to.I am implementing a multi list graph and I need to iterate through my STL list of Vertex pointer objects. I keep getting the error:

Error 1 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_List_iterator<_Mylist>' (or there is no acceptable conversion) and the same for != for my terminating condition.

template <typename V, typename E>
void Graph<V, E>::InsertEdge(V from, V to, E edge) {
list<Vertex<V>*>::iterator iter;
for(iter = m_Vertices.begin(); iter != m_Vertices.end(); ++iter)

[code].....

View 2 Replies View Related

C++ :: How To Make A Class Final

Oct 5, 2013

Just mark the destructor final: [URL] ....

Well, sort of - my question is, since the destructor has to be virtual in order to be marked final (you get an error otherwise), does this cause virtual function overhead anywhere, or add a vtable?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved