473,958 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List of compiler errors on functions

24 New Member
Anybody who can tell me the ?I'm the begginer..plz


Compiling...
91.cpp
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 8) : error C2501: 'offset' : missing storage-class or type specifiers
c:\documents and settings\admini strator\desktop \master\91.cpp( 8) : error C2065: 'random' : undeclared identifier
c:\documents and settings\admini strator\desktop \master\91.cpp( 9) : error C2501: 'coeff' : missing storage-class or type specifiers
c:\documents and settings\admini strator\desktop \master\91.cpp( 11) : error C2059: syntax error : ')'
c:\documents and settings\admini strator\desktop \master\91.cpp( 15) : error C2065: 'pow' : undeclared identifier
c:\documents and settings\admini strator\desktop \master\91.cpp( 15) : error C2059: syntax error : ')'
c:\documents and settings\admini strator\desktop \master\91.cpp( 16) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 17) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 17) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 17) : error C2143: syntax error : missing ';' before '}'
Error executing cl.exe.

91.obj - 14 error(s), 0 warning(s)








Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int createFunction( double &exponent, double &offset, double &coeff)
  6. exponent = random(100)+2; 
  7. offset = random(100) + 1; 
  8. coeff = random(100);
  9.  
  10. )
  11.  
  12. int useFunction( double x, double exponent, double offset, double coeff)
  13. {
  14.     return ( ( coeff * pow(x,exponent)) + offset))
  15. }
  16. }
Oct 5 '07 #1
4 2121
Meetee
931 Recognized Expert Moderator Contributor
Anybody who can tell me the ?I'm the begginer..plz


Compiling...
91.cpp
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 6) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 8) : error C2501: 'offset' : missing storage-class or type specifiers
c:\documents and settings\admini strator\desktop \master\91.cpp( 8) : error C2065: 'random' : undeclared identifier
c:\documents and settings\admini strator\desktop \master\91.cpp( 9) : error C2501: 'coeff' : missing storage-class or type specifiers
c:\documents and settings\admini strator\desktop \master\91.cpp( 11) : error C2059: syntax error : ')'
c:\documents and settings\admini strator\desktop \master\91.cpp( 15) : error C2065: 'pow' : undeclared identifier
c:\documents and settings\admini strator\desktop \master\91.cpp( 15) : error C2059: syntax error : ')'
c:\documents and settings\admini strator\desktop \master\91.cpp( 16) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 17) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 17) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\admini strator\desktop \master\91.cpp( 17) : error C2143: syntax error : missing ';' before '}'
Error executing cl.exe.

91.obj - 14 error(s), 0 warning(s)









#include <iostream>
using namespace std;


int createFunction( double &exponent, double &offset, double &coeff)
}

exponent = random(100)+2;
offset = random(100) + 1;
coeff = random(100);

)

int useFunction( double x, double exponent, double offset, double coeff)
{
return ( ( coeff * pow(x,exponent) ) + offset))
}
}
Hi,

First of all add stdlib header and use rand() function like this.
http://www.cplusplus.com/reference/c...dlib/rand.html

The bold part of the code is doubtfull as you should put proper braces!! Also put ; at the end of return statement. Analyse your code by yourself and you will find the errors yourself.

Regards
Oct 5 '07 #2
sicarie
4,677 Recognized Expert Moderator Specialist
There's also no main() which might be useful for calling the created functions...
Oct 5 '07 #3
keith katthy
24 New Member
I have done a correction, but I still dont know what a mistake.
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <iostream>
  4. #include <time.h>
  5. using namespace std;
  6.  
  7.     int main()
  8.     int createFunction, double &exponent double &offset double &coeff;
  9. {
  10.     srand ( time(NULL) );
  11.     exponent = random(100)+2; 
  12.     offset = random(100) + 1; 
  13.     coeff = random(100);
  14. {
  15.     int useFunction( double x, double exponent, double offset, double coeff)
  16. }
  17.  
  18.     return [(coeff*pow(x,exponent)) + offset)];
  19.  
C:\Documents and Settings\Admini strator\Desktop \MASTER\91.cpp( 8) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
C:\Documents and Settings\Admini strator\Desktop \MASTER\91.cpp( 8) : error C2146: syntax error : missing ';' before identifier 'createFunction '
C:\Documents and Settings\Admini strator\Desktop \MASTER\91.cpp( 8) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

91.exe - 2 error(s), 1 warning(s)


}
Oct 7 '07 #4
sicarie
4,677 Recognized Expert Moderator Specialist
keith katthy-

You're missing a very fundamental part of the structured programming languages that are used in C and C++. You need to sit down with a teacher or tutor for a few hours and go over program structure, libraries/includes, functions, main, etc... This is also a good resource if you go through it very carefully and play with each of the examples. However, the things that you are missing are very basic, and not conveyed well through a BBS - you would learn much more in a face to face encounter.
Oct 8 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
1951
by: Christof Krueger | last post by:
Hello, I'm quite new to C++ so maybe there's something I miss. I write a simple board game. It has a board class. This class has a method that returns the count of pieces a player has on the board. Since this function does not change anything in the class I declared it as const. To count all pieces of a given color the functions iterates through a "map" of CNode-pointers. "CNode" is another class that is irrelevant to the problem.
5
2355
by: Darryl B | last post by:
I can not get anywhere on this project I'm tryin to do. I'm not expecting any major help with this but any would be appreciated. The assignment is attached. The problem I'm having is trying to set up the class link and tel_list. I set up a class person with strings for name, town, and number. I just don't know how to set up the classes w/ their methods (constructors and operations). I'm stuck on the assignment operator and the add and...
7
1755
by: berkay | last post by:
i have a txt file; berkay#white jack#black smith#jane writes in it. and after i run the program it only prints smith jane and crashes what is wrong?
7
2185
by: dam_fool_2003 | last post by:
friends, I wanted to learn the various ways of inserting a single list. so: Method 1: #include<stdlib.h> #include<stdio.h> struct node { unsigned int data; struct node *next;
6
4611
by: Steve Lambert | last post by:
Hi, I've knocked up a number of small routines to create and manipulate a linked list of any structure. If anyone could take a look at this code and give me their opinion and details of any potential pitfalls I'd be extremely grateful. Cheers Steve
2
5855
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to create a dll, using the cl compiler I was getting many unresolved external errors, Example 1 below (8 in total, 7 to do with the registry function calls and 1 from wsprintfA call) as I hadn't included the AdvAPI32.lib file. So I created a LINK...
57
4399
by: Xarky | last post by:
Hi, I am writing a linked list in the following way. struct list { struct list *next; char *mybuff; };
9
2266
by: Erik | last post by:
Hi, i have this struct and this linked list /* structure describing a book.*/ typedef struct { char code; char author; char title; int year; int reserved; } Book;
2
2191
by: Chris Thomasson | last post by:
I was wondering if the 'SLINK_*' and 'SLIST_*' macros, which implement a simple singly-linked list, will produce _any_ possible undefined behavior: ____________________________ #include <stdio.h> #include <stdlib.h> #include <assert.h>
12
4082
by: kalyan | last post by:
Hi, I am using Linux + SysV Shared memory (sorry, but my question is all about offset + pointers and not about linux/IPC) and hence use offset's instead on pointers to store the linked list in the shared memory. I run fedora 9 and gcc 4.2. I am able to insert values in to the list, remove values from the list, but the problem is in traversing the list. Atlease one or 2 list nodes disappear when traversing from the base of the list or...
0
10255
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10066
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11697
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11314
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11464
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6296
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4630
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3650
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.