49,761 Topics

Member Avatar for
Member Avatar for ConfusedLearner

Using a text editor (i.e. Notepad), create a text file called Text1.txt and place it into a folder of your choosing. Fill Text1.txt with a sentence and save the file. Then, write a C++ program that performs the following: 1. Reads the sentence from the file Text1.txt and display it …

Member Avatar for bboy_fresh
0
265
Member Avatar for cableworm

Hi. I have an array of structs problem. I am having issues with my getname getprice functions. I need to be able to enter a code and return the name and price for that item. The values I return are for all items. It looks like it should be simple …

Member Avatar for cableworm
0
166
Member Avatar for Zssffssz

I want my program to not rely excessively on external stuff as possible so could someone help/point me in the right direction to hand writing a .wav codec? Or whatever codec would be the easiest. Sorry I was gone so long, family.

0
101
Member Avatar for MyRedz

hi i am doing crc coding for c and cant get the remainder and dataword +remainder= codeword any help here [CODE] #include <stdio.h> #include<stdlib.h> #include <conio.h> int main() { int a[20],b[20],c[20],i,k,j,n,s=0,t=0; printf ( "Welcome to the CRC Encoder/Decoder!\n"); printf ( "press n to exit at anytimes\n"); /* do{*/ printf("enter size …

Member Avatar for sixstringartist
0
105
Member Avatar for siabenie

Hi all, I am new in C++, I wonder if anyone could assist me about create a two classes. Basically I need to create class scale and translate where these two classes are inheritance from transition class. In the scale class contain e.g Public: scale(); ~scale draw(); operator >>; same …

Member Avatar for siabenie
0
133
Member Avatar for anamoblu56

I am a beginner and I am using Visual Studio 2008. My code is good and output is: Day 1, "Enter Temperature 1: Day 1, "Enter Temperature 2: and so on until Day 7. What I want it to read is: Day 1, "Enter High Temerature 1: (for column [0]) …

Member Avatar for anamoblu56
0
82
Member Avatar for pinkboom

Hey guys, I wrote a 'bigger' program that uses a basic algorithm to crypts a text I input from keyboard, or from another text file. I have divided the program in the 'working' part and the 'non-working' part. The keyboard input is great, it works perfectly. But when I try …

Member Avatar for pinkboom
0
149
Member Avatar for anamoblu56

Declare a seven-row, two-column int array named temperatures. The program should prompt the user to enter the highest and lowest temperatures for seven days. Store the highest temp in the first column and the lowest in the second column. The program should display the average high and average low for …

Member Avatar for MandrewP
0
2K
Member Avatar for topdos

hi i am new here and i registered because i couldn't find the answer in google search my problem is that i could not find max and min of two arrays and the average too [CODE]#include<iostream> using namespace std; int array1[]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; …

Member Avatar for topdos
0
449
Member Avatar for Srinivas0

can some one please explain what is static variable, i tried reading some books, tried googling but i am not able to understand what are its uses. [QUOTE]a static variable retain their value even after the function to which it belongs is executed.[/QUOTE] i am not understanding what is meant …

Member Avatar for mrnutty
0
256
Member Avatar for anamoblu56

Have patience as I am a beginner at this.I have completeed my 2d Array and have displayed its contents successfully. At the end of my program I want to total column 1 and 2 ([0],[1]) and eventually average it, but my code is not giving me the correct math(see input …

Member Avatar for anamoblu56
0
99
Member Avatar for ahoysailor

Ok, so basically I have a text file that contains the following: Resource3 "Actuator" Resource10 "Insert Exhaust Valve" Resource1 "6, 10, 18, 1" Resource21 "Emergency Stop" Resource2 "Cool Down in Progress" etc. etc. I want to read the file line by line and store it in a vector (this is …

Member Avatar for mrnutty
0
174
Member Avatar for northrox

i still cant get an out put.. plus cin.get() doent work here.. why? [CODE]// to find factorial of a number #include<iostream.h> #include<conio.h> int main() { int i,m; cout<< "enter a number"; cin>> i; for ( int p=i;p>=0;p--) { p=p*(p-1); p=m; } cout << m; getch(); return(0); } [/CODE]

Member Avatar for Schol-R-LEA
0
96
Member Avatar for uzidon

All right, the solution for this question might be awkwardly simple, but I'm totally lost and confused on this. I have created a Windows Form Application in Visual C++ 2010 Ultimate and included some resource files (BMP Images) in Form1.resX. For example, one of them is picture1.bmp. I have a …

Member Avatar for uzidon
0
1K
Member Avatar for northrox

[CODE=cpp]#include <iostream.h> #include <conio.h> int main() { int number[5]; cout<< " enter the number \n"; for (int i=0;i<=5;i++) { while (i!=$) { cin >> number[i]; } } for (int i;i<='null';i++) { cout<< "number="<<number[i]; } getch(); return (0); }[/CODE] i have used a special character which tells the user to press$ …

Member Avatar for Schol-R-LEA
0
121
Member Avatar for Muhammad Anas

I have written the following for loop to demonstrate ceil() function of <cmath>. [CODE]for (double ceilDemo = 2.0; ceilDemo <= 3.0; ceilDemo += 0.1) cout << setw(10) << ceilDemo << setw(20) << ceil( ceilDemo ) << endl;[/CODE] The output is as expected except for the last iteration. I mean in …

Member Avatar for Muhammad Anas
0
121
Member Avatar for stereomatching

I would like to make pugixml print the node_pi as [code] <?xml version="1.0" encoding="utf-8"?> [/code] How could I manipulate node_pi through pugixml? Thanks

0
65
Member Avatar for Arkinder

I recently had an assignment that asked us to restrict the amount of characters a user can enter for his or her name. My professor said this is useful in the event that your program is being "attacked." The simplest solution was to use C strings: [CODE]#include <iostream> const int …

Member Avatar for Arkinder
0
6K
Member Avatar for MadeleinePV

Hi all, I've got a class which I would like to hold a stream used for logging. The stream should be able to be set (and possibly reset) after the construction of the object. It should be possible to set the stream as std::cout, or as a file stream to …

Member Avatar for mrnutty
0
960
Member Avatar for rjstamey

I was wondering if there is a way to make it so that someone can only input a specific data type. My program ask for input of specific numbers for a menu. If I enter a character, the program crashes. Is there a way to make it so that it …

Member Avatar for WaltP
0
105
Member Avatar for Jameske

So I have written some code which reads a file line by line, breaking each line into characters and storing into a multidimensional array. However the program freezes and crashes at lines 31-34. When debugging the code runs successfully through the for loop once, then fails at 32 the second …

Member Avatar for Jameske
0
212
Member Avatar for wmurrow

I have to count the number of records being read in and print them to the screen. A record consists of: website name (temp.url), website revenue (temp.rev) and website hits (temp.hits). These are all read in and returned as temp. For the life of me though, I can't figure out …

Member Avatar for wmurrow
0
108
Member Avatar for NoUserNameHere

Not getting any compile error, but I'm getting an output that looks like: -858993460 5 4 3 2 Instead of 5 4 3 2 1. What am I doing wrong? [CODE]#include <iostream> #include <stack> using namespace std; template <typename T> void reverse(stack<T> &sk) { stack<int> tempStack; while(!sk.empty()) { tempStack.push(sk.top()); sk.pop(); …

Member Avatar for tharumax
0
97
Member Avatar for flendernik

Hi! Can anyone please tell me where my mistake in this is? The information from the list has to be transferred to the tree. But only the first element is copied. [CODE]#include<iostream> #include<string> using namespace std; struct Person{ char first[30], last[30]; }; struct aList { char adr[30]; Person name[30]; int …

Member Avatar for flendernik
0
135
Member Avatar for Brian_L

In my program, I used a vector to store the file. The file contains the data (see below). Do I need to create two vectors to store the data below as integers and strings? Or is there a shorter way to do this, and just allow the user to enter …

Member Avatar for Brian_L
0
97
Member Avatar for Kuroshi

I get this compiler error: `Monster' was not declared in this scope, in this code: [CODE]#ifndef ROOM_H #define ROOM_H #include <stdio.h> #include <stdlib.h> #include <time.h> #include <vector> #include <iostream> #include "Monster.h" using namespace std; const int ROWS = 20; const int COLS = 20; class Room { private: vector<int> indexes; …

Member Avatar for VernonDozier
0
123
Member Avatar for Valociraptor

I am attempting to create a sorted array for a class assignment but I am receiving a weird access violation error in my debug code. I have double checked all my values and nothing is accessing anything out of range. My code is below. Thanks. [code=c++] #include <iostream> using namespace …

Member Avatar for Schol-R-LEA
0
219
Member Avatar for Kuroshi

I am experiencing problems with this function: void move (Room&); For some reason the compiler is saying that this is a variable or field, here is the implementation: [CODE]void Monster::move (Room& room) { vector<int> iCoordinates; vector<int> jCoordinates; for (int i = x - 1 ; i <= x + 1 …

Member Avatar for Kuroshi
0
326
Member Avatar for EXpoZuR

My program needs to take the first 5 numbers from a file, sort them and print them out. Then take the next 5 numbers and sort just those 5 numbers and print them out. However, when I try to sort them independently it is sorting them all together as if …

Member Avatar for EXpoZuR
0
100
Member Avatar for dancks

I haven't coded something this complex in C++ before and I haven't had time to really review. I'm making a game (well, foundations for a game anyway), with an external game library, Allegro. But I think the problems I'm having is more fundamental to C++ in general. Included is a …

Member Avatar for dancks
0
298

The End.