|
|
#define D define
#D Y return
#D R for
#D e while
#D I printf
#D l int
#D W if
#D C y=v+111;H(x,v)*y++= *x
#D H(a,b)R(a=b+11;a<b+89;a++)
#D s(a)t=scanf("%d",&a)
#D U Z I
#D Z I("123\
45678\n");H(x,V){putchar(".XO"[*x]);W((x-V)%10==8){x+=2;I("%d\n",(x-V)/10-1);}}
l V[1600],u,r[]={-1,-11,-10,-9,1,11,10,9},h[]={11,18,81,88},ih[]={22,27,72,77},
bz,lv=60,*x,*y,m,t;S(d,v,f,_,a,b)l*v;{l c=0,*n=v+100,j=d<u-1?a:-9000,w,z,i,g,q=
3-f;W(d>u){R(w=i=0;i<4;i++)w+=(m=v[h[i]])==f?300:m==q?-300:(t=v[ih[i]])==f?-50:
t==q?50:0;Y w;}H(z,0){W(E(v,z,f,100)){c++;w= -S(d+1,n,q,0,-b,-j);W(w>j){g=bz=z;
j=w;W(w>=b||w>=8003)Y w;}}}W(!c){g=0;W(_){H(x,v)c+= *x==f?1:*x==3-f?-1:0;Y c>0?
8000+c:c-8000;}C;j= -S(d+1,n,q,1,-b,-j);}bz=g;Y d>=u-1?j+(c<<3):j;}main(){R(;t<
1600;t+=100)R(m=0;m<100;m++)V[t+m]=m<11||m>88||(m+1)%10<2?3:0;I("Level:");V[44]
=V[55]=1;V[45]=V[54]=2;s(u);e(lv>0){Z do{I("You:");s(m);}e(!E(V,m,2,0)&&m!=99);
W(m!=99)lv--;W(lv<15&&u<10)u+=2;U("Wait\n");I("Value:%d\n",S(0,V,1,0,-9000,9000
));I("move: %d\n",(lv-=E(V,bz,1,0),bz));}}E(v,z,f,o)l*v;{l*j,q=3-f,g=0,i,w,*k=v
+z;W(*k==0)R(i=7;i>=0;i--){j=k+(w=r[i]);e(*j==q)j+=w;W(*j==f&&j-w!=k){W(!g){g=1
;C;}e(j!=k)*((j-=w)+o)=f;}}Y g;}
|
|
|
|
|
I have OCX created in VC++ that has many functions. OCX has got some GUI.
I want to use those functions in C# web application without loading OCX. i.e. I want to extract only functions from OCX. Can anyone please suggest how this can be done?
|
|
|
|
|
Copy and paste?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
i have been trying to make create this program, it's kinda hard for me to get help in real life because I'm the only computer science student in my second semester.
this is c++. I have to use arrays
I have to make a program that shows grades, based on marks. The number of students depends on the user input.
grade A >=90
grade B >=80
grade C >=70
grade D >=60
grade F <=59
based on the homework my lecturer has given me, the output has to be like this
Enter the number of students: 4
Enter 4 marks: 40 55 70 58
student 0 mark is 40 and grade is C
student 1 mark is 55 and grade is B
student 2 mark is 70 and grade is A
student 3 mark is 58 and grade is B
This is my code:
#include<iostream>
using namespace std;
int main(){
int students;
int mark;
int x;
char grade[6]={'A','B','C','D','F','\0'};
cout<<"enter the number of students"<<endl;
cin>>students;
cout<<"enter "<<students<<" marks "<<endl;
for(x=0;x<students;x++){
cin>>mark;
if(mark>=90)
grade[0];
else if(mark>=80)
grade[1];
else if(mark>=70)
grade[2];
else if(mark>=60)
grade[3];
else
grade[4];
cout<<"student "<<students<<" mark is "<<mark<<" and grade is "<<grade[x];
}
}
I don't know what to do anymore. Help me
|
|
|
|
|
You have to use arrays. So you should learn about them:
Arrays - C++ Tutorials[^]
std::array - cppreference.com[^]
The example output shows also that you need two loops:
One to read the user input and store it within the array and another one to print the items.
It is up to you what to store in the array: The mark or the grade. Depending on that the conversion has to be done in the first or second loop. But I would store the mark because that is the data entered by the user and is therefore not lost and can be re-used (e.g. when the next task is extending your program).
Because this is homework, you will not get a final solution here. But you should be able to proceed with my above tips.
|
|
|
|
|
if(mark>=90)
grade[0];
The expression in the second line does nothing.
cout<<"student "<<students<<" mark is "<<mark<<" and grade is "<<grade[x];
The value of x in the above statement is the loop counter, so it has no relation to the actual grade value you are trying to deal with.
This is fairly basic C/C++ that you need to study and understand.
|
|
|
|
|
Quote: I don't know what to do anymore. Help me
Use the debugger to check what part of your code match your expectations and which part don't, it will help you to marrow the search of defects.
When you don't understand what your code is doing or why it does what it does, the answer is debugger.
Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it is an incredible learning tool.
Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.
Here is links to references books on C and C++ by the authors of the languages. Note than C is the ancestor of C++, so knowing C is always useful with C++.
The C Programming Language - Wikipedia, the free encyclopedia[^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[^]
C++ Programing Language[^]
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
my english is poor ,so I want to help you ,but I can't tell you in english. we can learn together.
|
|
|
|
|
Hi Friends,
I am using VS2015 and having a solution having 33 VC++ projects. I am using Klocwork insight 11.0 for code analysis work.
while running it, its getting stuck on any of the file. I tried re-installing Klocwork and restarting visual studio as well.
Please help me out if anyone have any idea.
Regards,
Amrit
|
|
|
|
|
|
Hello everybody,
I don't know if I omits something or if I've not correctly understanded something, but I've an Strange exception.
This is the code who generates the exception :
<br />
NetTcpBinding^ binding = gcnew NetTcpBinding();<br />
binding->Name = "IMyWebService";<br />
EndpointAddress^ address = gcnew EndpointAddress("myUrl");<br />
<ChannelFactory<IMyWebService^>^> factory = gcnew ChannelFactory<IMyWebService^>(binding, address);<br />
Exception System.ArgumentNullException occurs on last line.
"All parameter names used in operations that constitute a service contract must be not null. Parameter name : name"
Have you any idea why I'm receiving this exception ?
Many thanks for your help
Best regards,
Syncerely yours,
|
|
|
|
|
You need to use the debugger to examine both of the new objects and see exactly which property is causing the exception.
|
|
|
|
|
Hi,
Thanks for your reply.
Of course. Objects have been examined but no null name parameter was found.
I've tested using configuration file on the Web service to define the service, behavior, ... rather than using code only.
But same error.
Debugger was checked on both side (client / service).
Very strange.
Regards,
Syncerely yours,
|
|
|
|
|
The error message is quite clear, so there must be a null parameter somewhere. It may well be inside the actual framework, caused by something not being built correctl. And the only way to find it is by going deep in the debugger.
|
|
|
|
|
How do I increase size of my tooltip control as I need to show image to my tooltip I probably need to increase size of my tooltip control?
I tried using Text Renderer Measure Text but it just for increasing size according to text we provide.I want to increase size means height and width of my tool Tip so that my whole image gets displayed. Right now only part of image getting displayed using graphics Draw Image function according default size of tool Tip which is small.I am also providing default size of my image by using Graphics Draw Image function.But since size of my toolTip is small only part of image getting displayed.
|
|
|
|
|
|
Thanks.But actually i wanted to modify my toolTip means increase height or width without using HANDLE.Also i tried to create Rectangle using DrawImage function but didnt worked.
|
|
|
|
|
Why not just use a method that works?
|
|
|
|
|
can we use # sign at places other than with the header files
|
|
|
|
|
Yes, you should have #include in your cpp as well. Other uses are the various #pragma s, #define , and is a part of preprocessor operators[^]
Header files are simply to separate definition from implementation generally speaking. They aren't anything special as far as the language itself is concerned.
EDIT: And preprocessor directives[^] in general, just to clarify.
modified 22-Dec-16 12:12pm.
|
|
|
|
|
|
void CreateFolderPath(string Path)
{
char *strFolderPath = new char[Path.size() + 1];
strcpy_s(strFolderPath, Path.size() + 1, Path.c_str());
_mkdir(strFolderPath);
}
string ConvertIntToString(int cipher, int objintiger)
{
string temp;
char *Res = new char[cipher];
sprintf_s(Res, cipher, "%02d", objintiger);
temp = Res;
return temp;
}
//
Is there room for memory problems?
|
|
|
|
|
There are problems (memory leaks). You must delete memory allocated with new when not used anymore:
void CreateFolderPath(string Path)
{
char *strFolderPath = new char[Path.size() + 1];
strcpy_s(strFolderPath, Path.size() + 1, Path.c_str());
_mkdir(strFolderPath);
delete [] strFolderPath;
}
string ConvertIntToString(int cipher, int objintiger)
{
string temp;
char *Res = new char[cipher];
sprintf_s(Res, cipher, "%02d", objintiger);
temp = Res;
delete [] Res;
return temp;
}
For your first example there is even no need to copy the string. Just pass it to _mkdir() :
void CreateFolderPath(string Path)
{
_mkdir(Path.c_str());
}
|
|
|
|
|
Thank you very much!!!!
|
|
|
|
|