C :: Program Not Printing Exactly

Mar 9, 2013

I expected this program to print out:

Code: Enter your desired monthly salary: $2000___
Gee! $2000.00 a month is $24000.00 a year. Instead, it printed out:
Code: Enter your desired monthly salary: $2000___

Gee! $2000.00 a month is $24000.00 a year. I don't understand how it got the extra nextline in the middle.

Here is the code:

Code:

#include <stdio.h>
int main(void) {
float salary;
printf("aEnter your desired monthly salary:");

[Code].....

View 2 Replies


ADVERTISEMENT

C++ :: Program For Printing All The Combinations Of A String

Feb 17, 2013

I am trying to write a program for printing all the combinations of a string. Why this program is giving the error message.

"First-chance exception at 0x761bc41f in word.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0026f6b4..
Unhandled exception at 0x761bc41f in word.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0026f6b4.." when i try to run this in MVS 2010

#include<iostream>
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include<conio.h>
void combination(std::string input,int length,std::string buffer,int allowedno)

[Code] .....

View 1 Replies View Related

C/C++ :: Program Printing Out Random Symbols?

Jan 19, 2014

I'm experimenting, making a little client/server but when it cout's the buffer, it prints out random symbols.

Server

#include <iostream>
#include <windows.h>
#include <WinSock2.h>
int main() {
char buffer[1024];
WSAData wsa;

[Code] ......

View 9 Replies View Related

C++ :: Program Crashes While Printing Data From Vectors

Nov 23, 2013

I have a local student and international student class inherit from student class. read and print are virtual functions. After i have set all the member variables when i wan to print out all the student information, my program crashes.

Code: int main()
{
clsUniversityProgram objProgram[3];
for (int x = 0; x < 3; x++)

[Code] ....

View 4 Replies View Related

C :: Program Printing A Random Number Instead Of Variable

Mar 6, 2015

Program that has the user enter 5 digits then asks the user what they want to know about the 5 digits. My issue is when the program goes to print the value, its a totally ill related number

10 34 8 17 50

program prints out:

2 for smallest
79 for largest
119 for sum
23.80 for average

Code:

#include <stdio.h>#include <stdlib.h>
int main(void)
{
int smallNum, largNum, count=0, sum=0, value, choice;
double avgNum;
printf("Enter 5 integers
");
printf("
");

[Code]...

View 7 Replies View Related

C :: Program Not Printing Mac Address Correctly From Ethernet Header

Jun 2, 2013

I have a procedure that prints the fields of ethernet frames and ip headers. I have an issue with the src mac addr being printed incorrectly and incompletely. The part in red is the trouble code.

Code:
1#include "sniffer.h"
2
3void print_headers(struct ethhdr * ethhdr, struct ip * iphdr){
4
5 char ipstr_src[INET_ADDRSTRLEN];
6 char ipstr_dst[INET_ADDRSTRLEN];
7 char macstr_dst[ETH_ALEN], macstr_src[ETH_ALEN];

[Code] ....

View 2 Replies View Related

C/C++ :: Check Printing Program Breaks Halfway Through Running

Apr 3, 2015

For my c++ we're suppose to write a program that prints out a check. It's suppose to translate the numeric value of the dollars to worded strings.

Header File:

#ifndef CHECKWRITING_H
#define CHECKWRITING_H
#include <string>

[Code]....

View 1 Replies View Related

C++ :: Printing A Triangle

Oct 7, 2013

What the heck is wrong with my logic? I just print a rectangle!!! I have played with thing for ever it seems. I thought the rotating part would be hard but now I find myself stuck.

Code:
#include <istream>
#include "triangle.h"
using namespace std;
void triangle::create_triangle() {

[Code] ....

View 13 Replies View Related

C :: Printing TXT File From URL

Feb 8, 2014

I need c source that give the url txt file and print the txt file

(get the http://site.com/text.txt) and print the (text.txt) file Content.

View 1 Replies View Related

C :: Printing Array With A New Value

Nov 21, 2013

I have an array, ary[size+1] and the original values entered and then another value, x, entered. I found the index of x that makes the array nondecreasing order

Code:

void InsertX (int ary[], int size, int x)
{
int i=0;
int j;
int index;
while(ary[i]<x)

[Code]...

But i can't figure out how to print the new array with x in it, using its index

View 6 Replies View Related

C :: Printing A Box Using 2D Array

May 8, 2013

how to print a box using 2d arrrays. i have to create a tetris game which a im stuck at this stage... so far i have tired i can only come out with this..my coding done so far is as follows:

Code:

#include <stdio.h>
#define ROW 15
#define COLUMN 15
void disp_box (char b[ROW][COLUMN])
}

[code]....

View 2 Replies View Related

C++ :: Printing Name And GPA Of Student?

Feb 17, 2015

#include <iostream>
#include <string>
using namespace std;
struct studentType {
string name;
double gpa;

[Code] .....

View 11 Replies View Related

C++ :: Printing Out List Using OOP

May 17, 2013

#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::ios;
#include "Course.h"
#include <list>

[Code] ....

The program works well, except for the fact when it prints out the list (starting at the for-loop on line 65) each line is the same as the last, like it overwrites itself every time it traverses the while(true) loop.

View 9 Replies View Related

C++ :: Instead Of Printing In CMD Can Print Out In CSS / TXT?

Aug 13, 2014

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.

View 8 Replies View Related

C/C++ :: Echo Not Printing

Mar 9, 2014

A simple UNIX shell that supports some built-in commands, external commands, and file redirection.

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>

[Code]....

View 6 Replies View Related

C/C++ :: Printing Every Other Number?

Mar 22, 2015

I've got this assignment where I have to print every other number from 1 to 10.

so far I've got this.

#include <iostream>
using namespace std;
int main() {

[Code].....

wondering if its really counting from 1 to 10 and only printing every other number.

View 9 Replies View Related

C/C++ :: Printing The Day Of The Week?

Feb 3, 2014

I am writing a program that takes the Month, Day, and Year inputted from the user and outputs the day of the week (Ex. "February 2, 2014 falls on a Sunday"). I got it to print out the date but I can't figure out how to output the day. Would I be using the ctime function?

#include <iostream>
#include <string>
using namespace std;

[Code].....

View 1 Replies View Related

C++ :: Printing 10 Numbers Per Line?

Nov 3, 2013

I'm working on a program that prints every even number from 100 to 200. How i would be able to print 10 numbers per line?

Code:
#include <iostream>
using namespace std;
int main()
{
int x;
for (x=100; x<=200; x++)
cout <<x++<< endl;
system("pause");
return 0;
}

View 2 Replies View Related

C++ :: Printing A Binary Tree?

Feb 1, 2014

It only prints out the root in an infinite loop.

Code: void Btree::printTree(Node* tree)
{
tree=root;
if (tree != NULL)
{
std::cout<<" "<< tree->key;
printTree(tree->left);
printTree(tree->right);
}
}

View 5 Replies View Related

C++ :: Printing Text With Functions

Feb 27, 2014

Any way to make a function that prints something. i wanted to make a function for

Code:

cout << " PAUSE MENU " << endl; cout << " 0. Resume Game " << endl;
cout << " 1. Commands " << endl;
cout << " 2. Controller Setup " << endl;
cout << " 3. Bottles of Beer " << endl;
cout << " 4. Quit " << endl;
cout << " What is your Choice - ";
cin >> userinput;

So i wouldn't have to retype it again in the loop, i would just call the function. but it seems whatever i try it doesn't display the text. i've tried making a function with no return time like this " Void Pausemenu(); " but that just goes blank.

Code:

#include <iostream>
using namespace std;
//This function displays different results based on the users input
int menu(int menuchoice);
int main()

[Code] ....

View 4 Replies View Related

C++ :: 3 Dimensional Array Printing?

Oct 25, 2013

I want to make a program that asks the user for a message and then print out a large graphic of that message. For example, if the user types "he" I want to print out

H..................H EEEEEEEEE
H..................H E
H..................H E
H..................H E
HHHHHHHHHH EEEEEEEEE
H..................H E
H..................H E
H..................H E
H..................H EEEEEEEEE

(treat the periods as spaces. I only put them there because it wouldn't separate the H's correctly.)

I will loop this to continue until the user types quit.

1. How would I set this up to store the user input characters into an array?

2. How would I print out the stored data in the shape of the word?

View 4 Replies View Related

C :: Printf In A While Loop Is Printing Twice Instead Of Once

Sep 21, 2013

I have a minor issue in my program:

Code:
char Answer;
printf("
To search for a specifc word, type (Y), to use a dictionary file, type (N):

[Code] .....

When I run the program, it gives:

To search for a specific word, type (Y), to use a dictionary file, type (N):

Sorry, the given input is invalid, please try again:

I can then input the number. Typing n,N,y or Y goes to the next part of the program without any problems, but if I type something else, I get:

Sorry, the given input is invalid, please try again:

Sorry, the given input is invalid, please try again:

I've fiddled about with the code for a while now, but nothing I do seems to work. What is causing it to be printed twice, or why the first getchar() is ignored.

View 2 Replies View Related

C :: Printing A Rectangle Using For Loops?

Jan 27, 2015

I'm trying to make a program that prints a rectangle using "*" asterisks. I am only allowed to use "for loops" and I simply cannot get this to work properly. Here is my code so far...

Code:
int main(void)
{
//RectangleSize represents the area of the rectangle(width*length)
int length, width, RectangleSize;

[Code].....

View 5 Replies View Related

C :: Printing A Parallelogram From Letters

Nov 14, 2013

These are the instructions: read a number between 1-26 and build a parallelogram in the size (height&width) of the number entered.

Each row of the parallelogram will be built from each capital letter from 1 to the number read (max 26).for example: by entering the number 3, will be printed:

AAA
_BBB
__CCC

for the number 4:
AAAA
_BBBB
__CCCC
___DDDD

I am struggling with how to change each char in every different row, how do I print this parallelogram ?

View 8 Replies View Related

C :: IF Construct And Printing Strings

Apr 26, 2014

This code i made divided a user input into characters and non character. The problem im having is that if a mixed sentence is created, such as 32B, it will only print the 'char string' and not the 'non char string'. But when the sentence is just non characters like 32 it will print the 'non-char string'. So essentially if a mixed sentences is created both of the strings won't be created or printed.(This is only a function by the way).

Code:

Count_chars( char Input[]) {
int i;
for(i = 0; Input[i]; i++) {
if((Input[i] <= 122) &&(Input[i] >= 97)){
printf("Char %c ",Input[i]);
Char[i] = Input[i];

[Code]...

View 4 Replies View Related

C :: Printing A Circle In PPM Image

Oct 30, 2013

I'm supposed to print a small rectangle inside concentric circles that are inscribed in a rectangle.I'm not really sure where to start with printing a circle in a ppm file.

View 13 Replies View Related







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