understanding errors

Hey,
i am doing a school project and i find myself struggling with c++.
i was given a .txt file with the the numbers arranged as below.

-9 -7 0 2 8 11 12 17 20 22 25 36 40 44 50 60

the file name is data_celsius.txt

i have been trying to make a program to read the data convert the numbers into fahrenheit and store them in another file.

the errors im getting are on lines 67-70 such errors as "invalid conversion from void to int","at this point in file",and ""no matching function for call to getline(std:: ifstream&int&,int&,int&..." i have looked them up but do not get how to fix my mistakes.

the code below is just me trying to see if i can make the task work it will be completed when i get the function to write the file. also this is probably the worst approach and requires much more code than necessary. like i said i am struggling in this class. i have read the chapters in my book and i am not able to make sense of what they are doing. my teacher just told me to read the chapters after i told him i did. so no help there. please help C++ is not one of my strengths.

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>

using namespace std;

int myc2f (int num_1, int num_2, int num_3, int num_4, int num_5, int num_6, int num_7, int num_8, int num_9, int num_10, int num_11, int num_12, int num_13, int num_14, int num_15, int num_16)
{

  ofstream myfile;
  myfile.open("Rivero_Fahrenheit_Output.txt"); 
 
	int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
	a = (9.0/5)*(num_1 + 32);
	b = (9.0/5)*(num_2 + 32);
	c = (9.0/5)*(num_3 + 32);
	d = (9.0/5)*(num_4 + 32);
	e = (9.0/5)*(num_5 + 32);
	f = (9.0/5)*(num_6 + 32);
	g = (9.0/5)*(num_7 + 32);
	h = (9.0/5)*(num_8 + 32);
	i = (9.0/5)*(num_9 + 32);
	j = (9.0/5)*(num_10 + 32);
	k = (9.0/5)*(num_11 + 32);
	l = (9.0/5)*(num_12 + 32);
	m = (9.0/5)*(num_13 + 32);
	n = (9.0/5)*(num_14 + 32);
	o = (9.0/5)*(num_15 + 32);
	p = (9.0/5)*(num_16 + 32);
	myfile << "tempature in Fahrenheit"<<endl;
	myfile << a << b << c << d << e << f << g << h << i << j << k << l << m << n << o << p ;
	myfile.close();
	return 0;
	} 

void myMenu()
{ 

 cout<<"Option 1 Convert Celsius to Fahrenheit"<<endl;
 cout<<"Option 2 Convert Fahrenheit to Celsius"<<endl;
 cout<<"Option 3 Exit"<<endl;
 }

	int main()
		{
		
		{
		myMenu();
		int xin;
		cin >> xin;
		system("CLS");
		
		while(xin !=3)
	

			if(xin == 1)
			{
			  string line;
			  ifstream myF;
			  myF.open("data_celsius.txt");
			  if(myF.is_open())
			{
			 while(! myF.eof())
			
			{
			int num_1, num_2, num_3, num_4, num_5, num_6, num_7, num_8, num_9, num_10, num_11, num_12, num_13, num_14, num_15, num_16;
			
                        getline (myF, num_1, num_2, num_3, num_4, num_5, num_6, num_7, num_8, num_9, num_10, num_11, num_12, num_13, num_14, num_15, num_16);
    	                myc2f(myF);
			}
			myF.close();
						
				
					
	cout<<"Your data has been converted to Fahrenheit"<<endl;
	myMenu();
	cin >> xin;
	system("CLS");
	}
	}
        }
	}
	

getline() takes two arguments. The first one is the stream to get the line from, the second is a string to put the line into. You cannot getline into integers nor can you do more than one at once.
Topic archived. No new replies allowed.