944,080 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3459
  • C++ RSS
Feb 24th, 2005
0

please help with these error problems

Expand Post »
#include <iostream>
using namespace std;
#include <string>
#include<cstring>

int main()
{

char list1[50][31],list2[50][31],list3[100][31];
int i, size1, size2, i1, i2, i3;
char ch;
int inf;
ifstream indata;
ofstream outdata;



// read each list
while(inf.peek()= EOF)
{
inf>> list1[i];
i++;
size 1=i;
i=0;
}
while(inf.peek()= EOF)
{
inf>>list2[i]; i++;
}
size 2=i;

while(i1< size1 && i2 < size 2)
{
if (list1[i1]< list2[i2])
{
list3[i3]=list1[i2];
i3++; i1++;
}

else
if(list2[i2]<list1[i2])
{
list3[i3]=list2[i2];
i3++; i2++;
}
else
{
list3[i3]=list2[i2];
i3++; i2++; i1++;
}
if(i1<size1)
{
inf>>"everything left on list1 to list3:";
inf.getline(name[i]);
}
if(i2<size2)
{
inf<<"copy left on list2 to list3:";
inf.getline(ch);
}
}

return 0;
}




these are my errors

-----------------Configuration: assign3 - Win32 Debug--------------------
Compiling...
assign3.cpp
C:\assign3.cpp(13) : error C2079: 'indata' uses undefined class 'basic_ifstream<char,struct std::char_traits<char> >'
C:\assign3.cpp(14) : error C2079: 'outdata' uses undefined class 'basic_ofstream<char,struct std::char_traits<char> >'
C:\assign3.cpp(18) : error C2228: left of '.peek' must have class/struct/union type
C:\assign3.cpp(18) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.

assign3.exe - 4 error(s), 0 warning(s)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
missy is offline Offline
13 posts
since Nov 2004
Feb 24th, 2005
0

Re: please help with these error problems

missy\assign3.cpp: error C0001: missing code tags
Reputation Points: 17
Solved Threads: 9
Posting Whiz in Training
frrossk is offline Offline
220 posts
since Sep 2004
Feb 24th, 2005
0

Re: please help with these error problems

add this to the top of your file
C++ Syntax (Toggle Plain Text)
  1. #include <fstream>
Reputation Points: 10
Solved Threads: 1
Light Poster
Intel is offline Offline
30 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Choosing a programing languge.
Next Thread in C++ Forum Timeline: Round Robin Time Slicing





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC