No its a different forum so I thought it would help me more to get more input. I thought if I didn't get a reply here I might there. I got this program on Thursday and it is due on Monday and I...
Type: Posts; User: cannsyl
No its a different forum so I thought it would help me more to get more input. I thought if I didn't get a reply here I might there. I got this program on Thursday and it is due on Monday and I...
I honestly don't think so.
I don't know...I was following the template I was given...Like I said this was a c++ class and this is the only C I have ever done. I have no idea why we were thrown this curve at the end of the...
So if I have
int main()
{
char c;
int k;
FILE *fp;
fp=fopen("input.txt", "r");
how do you read in a txt file into a c program?
I have
int main()
{
char c;
int k;
//initialize
Sorry
I am just in a crunch and have been working on this for a while...with little instruction in class.
Here is my question now...Can you read in a .txt file in C the way you do in C++?
and I...
First I would like to thank tabstop for the very helpful reply. We haven't gone over this in class yet and you were able to clear it right up. I never would have thought to
If someone else...
Ok so too much code.
Simple question
which of my headers is deprecated or antiquated?
#include <iostream>
#include <fstream>
#include <cstdlib> // for exit(..)
#include <cstdio>
I am in a c++ class (actually my first real c++ class) but we are at the end of the semester and they are introducing data structures and I think this program is mostly in c but compiling with dev? ...
I know its alot, but could you comment out this code so I know what it means?
char stk_top(void) {
if (ptr > 0) {
error = 0;
return data[ptr-1];
} else {
error...
yes she wrote the .h file and gave it to us this is it
/* stack.h: Declarations for a stack of chars */
#define STK_ERROR '?'
void stk_init();
void stk_push(char);
char stk_pop(void);...
our instructor gave us a .h file
what does #define STK_ERROR '?' mean?
if std::stack is like <list> and uses the compiler to do something for me...my professor won't let us do that. She wants us to do things the long way first. But thanks for the other tips I kept...
I have to use stacks to check an input file for parentheses matches.
I have a skeleton...but I am having some problems
Do I have to use a class or struct to do this?
Here is what I have in main
...
Ok I am trying to sort a linked list and I have declared
private:
struct SongNode
{
Song s; //value in this node
SongNode *next; ...
ok I am getting an error that says
linker error undefined reference to 'Song::artist'
but I am not sure where in the code it is...
//song.h
#ifndef SONG_H
#define SONG_H
#include...
ok I am getting an error that says
in function 'std::ostream& operator<<(std::ostream&, const Song&):
invalid use of non-static data member 'Song::title'
it is in line 15 of this code
//song.h...
I tried adding the std::ostream, but that didn't seem to be it.
I don't know where you mean for me to put the <iostream> I do have it in my .h's
my function definition is
ostream & operator << ( ostream & os, BobCatPod & i)
{
os << i.getTotalMemory();
os << i.getRemainingMemory();
return os;
}
in bobcatpod.h...
the linker error i am getting is
undefined reference to 'operator<<(std::ostream&, Song const&)'
You guys have been great. I now have everything compiling, but I can't get it to run. I keep getting a linker error? I don't know why it doesn't link I have all my files included I think. What...
Ok I think I only have one more problem.
In my .h I have
friend ostream & operator<<(ostream & os, const Song & s);
and in my cpp
ostream & operator << ( ostream & os, Song & s)
{
...
how long did it take you to learn c++ and to catch on to things?
I am in my second class and I am frustrated that I don't think I am catching on like some of my class mates. I have only been...
Ok here is everything. why won't it work? I am getting so frustrated with this I feel like I have a puzzle with all the edge pieces missing.
//song.h
#ifndef SONG_H
#define SONG_H
#include...