3 Replies - 385 Views - Last Post: 18 April 2013 - 02:14 PM Rate Topic: -----

#1 makeyourselfgreat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 18-April 13

Writing a code and getting same errors

Posted 18 April 2013 - 01:53 PM

// code
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>

using namespace std;

  int GetNumRooms();
  int 1 to numRooms;
  int GetLength(room);
  int GetWidth(room);
  int balloons = length + width + BUNCH;
  void WriteRoomData(int streamers, int lights, int balloons);

  const string streamers = 2 * (length + width) * STR_COVERS;
  const string lights = 2 * (length + width) * LT_COVERS;
int main()
{
  for (int room = 1; room <= numRooms);
  cout << "How many rooms? " << endl;
  int numRooms;
  int for room;
  int length;
  int width;
  int streamers;
  int lights;
  int balloons;

  numRooms = GetNumRooms();
  length = GetLength(room);
  width = GetWidth(room)
  streamers = 2 * (length + width) * STR_COVERS;

  cout << "How many rooms? " << endl;
  cout << "What is the length of room: " << endl;
  cout << "What is the width of room: " << endl;

  outFile.open(p4a.dat.c_str());

  outFile << "90" << endl;

 return 0;
}  

// code

p4a.cpp:21: error: expected unqualified-id before numeric constant
p4a.cpp:22: error: ‘room’ was not declared in this scope
p4a.cpp:23: error: ‘room’ was not declared in this scope
p4a.cpp:24: error: ‘length’ was not declared in this scope
p4a.cpp:24: error: ‘width’ was not declared in this scope
p4a.cpp:24: error: ‘BUNCH’ was not declared in this scope
p4a.cpp:27: error: ‘length’ was not declared in this scope
p4a.cpp:27: error: ‘width’ was not declared in this scope
p4a.cpp:27: error: ‘STR_COVERS’ was not declared in this scope
p4a.cpp:28: error: ‘length’ was not declared in this scope
p4a.cpp:28: error: ‘width’ was not declared in this scope
p4a.cpp:28: error: ‘LT_COVERS’ was not declared in this scope
p4a.cpp: In function ‘int main()’:
p4a.cpp:32: error: ‘numRooms’ was not declared in this scope
p4a.cpp:32: error: expected ‘;’ before ‘)’ token
p4a.cpp:35: error: expected unqualified-id before ‘for’
p4a.cpp:43: error: name lookup of ‘room’ changed for ISO ‘for’ scoping
p4a.cpp:43: note: (if you use ‘-fpermissive’ G++ will accept your code)
p4a.cpp:43: error: ‘GetLength’ cannot be used as a function
p4a.cpp:44: error: ‘GetWidth’ cannot be used as a function
p4a.cpp:45: error: expected ‘;’ before ‘streamers’
p4a.cpp:51: error: ‘outFile’ was not declared in this scope
p4a.cpp:51: error: ‘p4a’ was not declared in this scope

errors that i keep getting back

This post has been edited by jimblumberg: 18 April 2013 - 02:10 PM
Reason for edit:: Added missing code tags. Please learn to use them properly.


Is This A Good Question/Topic? 0
  • +

Replies To: Writing a code and getting same errors

#2 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1072
  • View blog
  • Posts: 4,532
  • Joined: 09-June 09

Re: Writing a code and getting same errors

Posted 18 April 2013 - 01:55 PM

int 1 to numRooms;



What are you trying to do here?
Was This Post Helpful? 0
  • +
  • -

#3 makeyourselfgreat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 18-April 13

Re: Writing a code and getting same errors

Posted 18 April 2013 - 01:59 PM

View Postjjl, on 18 April 2013 - 01:55 PM, said:

int 1 to numRooms;



What are you trying to do here?


Trying to provide the number of room to be decorated.
Was This Post Helpful? 0
  • +
  • -

#4 jimblumberg  Icon User is offline

  • member icon


Reputation: 4018
  • View blog
  • Posts: 12,400
  • Joined: 25-December 09

Re: Writing a code and getting same errors

Posted 18 April 2013 - 02:14 PM

What are you trying to do with this line:
  int 1 to numRooms;


Next you are trying to use a bunch of variables before you have told the compiler about them. You need to create your variables before you can use them.

You may want to study this tutorial: Variables.


Jim
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1