Форум программистов, компьютерный форум CyberForum.ru

Чтение из файла - C++

Восстановить пароль Регистрация
 
Skrypnyk
1 / 1 / 0
Регистрация: 15.01.2013
Сообщений: 40
12.05.2013, 21:50     Чтение из файла #1
Здравствуйте.
Хочу, чтобы программа читала значения переменных из файла input.txt:
Кликните здесь для просмотра всего текста
Please choose the crystal lattice. Type 1 for BCC, 2 for FCC, and 3 for HCP: 2
Please enter lattice parameter (a): 1
For HCP please enter second lattice parameter (c): 1
Please enter the number of translated cells along X axis: 2
Please enter the number of translated cells along Y axis: 2
Please enter the number of translated cells along Z axis: 2

Более того, необходимо, чтобы считывались только цифры после двоеточия. Как это сделать?
И самое главное: программа не компилируется:
Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include "Atom.h" // contains definition of class 'Atom'
#include <fstream> // to read from file
 
using namespace std;
 
int main ()
{
    int latticeType;
    int dimX, dimY, dimZ; // number of translated cells along each axis
    float d; // lattice parameter
    float h; // second lattice parameter for HCP
    Atom myAtom; // object of class 'Atom'
    ofstream inputFile; // object of class 'ofstream' to read from it
 
    inputFile.open ("input.txt", ios::in); // open 'input.txt' only for reading
    if (!inputFile){
        cerr << "Unable to open input file";
        return -1;
    }
    while (!inputFile.eof()){
        inputFile >> latticeType;
    if ( (latticeType!=1) && (latticeType!=2) && (latticeType!=3) ){}
        cerr << "Invalid value of lattice type" << endl;
        return -1;
    }
        inputFile >> d;
        if (latticeType==3){
            inputFile >> h;
        }
        inputFile >> dimX;
        inputFile >> dimY;
        inputFile >> dimZ;
    }
    inputFile.close ();
 
    if (latticeType==1) myAtom.DoBCC ( d, dimX, dimY, dimZ ); // if 1, create BCC lattice
    else if (latticeType==2) myAtom.DoFCC ( d, dimX, dimY, dimZ ); // if 2, create FCC lattice
         else  if (latticeType==3) myAtom.DoHCP ( d, h, dimX, dimY, dimZ ); // if 3, create HCP lattice
 
    return 0;
}

Пишет ошибку:
Кликните здесь для просмотра всего текста
||=== MD - Assignment 1 (revision 3), Debug ===|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp||In function 'int main()':|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|error: no match for 'operator>>' in 'inputFile >> latticeType'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|33|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|error: no match for 'operator>>' in 'inputFile >> d'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|38|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|error: no match for 'operator>>' in 'inputFile >> h'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|error: no match for 'operator>>' in 'inputFile >> dimX'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|42|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|error: no match for 'operator>>' in 'inputFile >> dimY'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|error: no match for 'operator>>' in 'inputFile >> dimZ'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|44|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|24|warning: unused variable 'myAtom' [-Wunused-variable]|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|46|error: 'inputFile' does not name a type|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|48|error: expected unqualified-id before 'if'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|49|error: expected unqualified-id before 'else'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|50|error: expected unqualified-id before 'else'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|52|error: expected unqualified-id before 'return'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\BCC_FCC_HCP.cpp|53|error: expected declaration before '}' token|
||=== Build finished: 12 errors, 1 warnings (0 minutes, 10 seconds) ===|


Добавлено через 15 минут
Обновление:
1. программа:
Кликните здесь для просмотра всего текста
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <fstream> // to read from file
 
using namespace std;
 
int main ()
{
    int latticeType;
    int dimX, dimY, dimZ; // number of translated cells along each axis
    float d; // lattice parameter
    float h; // second lattice parameter for HCP
    ofstream inputFile; // object of class 'ofstream' to read from it
 
    inputFile.open("input.txt", ios::in); // open 'input.txt' only for reading
    if (!inputFile){
        cerr << "Unable to open input file";
        return -1;
    }
    while (!inputFile.eof()){
        inputFile >> latticeType;
        cout << latticeType << endl;
    if ( (latticeType!=1) && (latticeType!=2) && (latticeType!=3) ){}
        cerr << "Invalid value of lattice type" << endl;
        return -1;
    }
        inputFile >> d;
        cout << d << endl;
        if (latticeType==3){
            inputFile >> h;
            cout << d << endl;
        }
        inputFile >> dimX;
        cout << dimX;
        inputFile >> dimY;
        cout << dimY;
        inputFile >> dimZ;
        cout << dimZ;
    }
    inputFile.close();
 
    return 0;
}

2. Ошибки:
Кликните здесь для просмотра всего текста
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp||In function 'int main()':|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|error: no match for 'operator>>' in 'inputFile >> latticeType'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|31|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|error: no match for 'operator>>' in 'inputFile >> d'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|37|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|error: no match for 'operator>>' in 'inputFile >> h'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|40|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|error: no match for 'operator>>' in 'inputFile >> dimX'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|43|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|error: no match for 'operator>>' in 'inputFile >> dimY'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|45|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|error: no match for 'operator>>' in 'inputFile >> dimZ'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: candidates are:|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|998|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|957|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\istream.tcc|925|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<_CharT, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|725|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|730|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|772|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\istream|777|note: template argument deduction/substitution failed:|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|47|note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'std::basic_istream<char, _Traits>'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|50|error: 'inputFile' does not name a type|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|52|error: expected unqualified-id before 'return'|
C:\Users\oniltech\Dropbox\CMS\Molecular Dynamics\Assignment 1\MD - Assignment 1 (revision 3)\Untitled2.cpp|53|error: expected declaration before '}' token|
||=== Build finished: 9 errors, 0 warnings (0 minutes, 10 seconds) ===|
После регистрации реклама в сообщениях будет скрыта и будут доступны все возможности форума.
Olivеr
 Аватар для Olivеr
411 / 407 / 13
Регистрация: 06.10.2011
Сообщений: 830
12.05.2013, 21:51     Чтение из файла #2
Цитата Сообщение от Skrypnyk Посмотреть сообщение
Хочу, чтобы программа читала значения переменных из файла input.txt:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <fstream>
 
using namespace std;
 
int main()
{
    int choise;
    ifstream file("text.txt");
    char c;
    while (file.good()) {
        c = file.get();
        if (c == ':') {
            c = file.get();
            c = file.get();
            choise = static_cast<int>(c) - 48;
            cout << choise;
        }
    }
 
    file.close();
    return 0;
}
Skrypnyk
1 / 1 / 0
Регистрация: 15.01.2013
Сообщений: 40
12.05.2013, 22:09  [ТС]     Чтение из файла #3
Olivеr, спасибо большое. Объясните мне, пожалуйста, в теле if первый раз c = file.get(); читает пробел, а второй - само число, верно? У меня проблема возникает, если я меняю числа на двух- и более значные. И почему отнимается 48?
Olivеr
 Аватар для Olivеr
411 / 407 / 13
Регистрация: 06.10.2011
Сообщений: 830
12.05.2013, 22:19     Чтение из файла #4
Цитата Сообщение от Skrypnyk Посмотреть сообщение
У меня проблема возникает, если я меняю числа на двух- и более значные.
Вы писали:
Цитата Сообщение от Skrypnyk Посмотреть сообщение
чтобы считывались только цифры после двоеточия.
Цитата Сообщение от Skrypnyk Посмотреть сообщение
И почему отнимается 48?
Потому, что в ASCII коды цифр начинаются с 48.

Попробуйте так:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <fstream>
 
using namespace std;
 
int main()
{
    int choise;
    ifstream file("text.txt");
    char c;
    while (file.good()) {
        c = file.get();
        if (c == ':') {
            file >> choise;
            cout << choise << endl;
        }
    }
    file.close();
    return 0;
}
Skrypnyk
1 / 1 / 0
Регистрация: 15.01.2013
Сообщений: 40
12.05.2013, 22:32  [ТС]     Чтение из файла #5
Olivеr, отлично, спасибо!

Кстати, ошибки более не актуальны. Ошибка при копипасте дала ofstream там, где нужен был ifstream, и была проблема со скобками.
Yandex
Объявления
12.05.2013, 22:32     Чтение из файла
Ответ Создать тему
Опции темы

Текущее время: 11:06. Часовой пояс GMT +3.
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Рейтинг@Mail.ru